Skip to content

inconsistent-multiple-service

Id
@azure-tools/typespec-client-generator-core/inconsistent-multiple-service

Severity: error

This diagnostic is issued when multiple services merged into one @client declaration do not have the same server and authentication definitions.

  • Area: Multi-service client merging. Blocks a combined client when merged services do not agree on endpoint or authentication shape.
  • Not affected: The individual service definitions, servers, and auth settings remain unchanged.
@service
@server("https://servicea.example.com")
namespace ServiceA {
}
@service
@server("https://serviceb.example.com") // differs from ServiceA server
namespace ServiceB {
}
@client({
name: "CombineClient",
service: [ServiceA, ServiceB],
autoMergeService: true,
})
namespace CombineClient {
}

TCGC reports:

All services must have the same server and auth definitions.

Make the merged services use matching server and auth definitions, or generate them as separate clients.

@service
@server("https://service.example.com")
namespace ServiceA {
}
@service
@server("https://service.example.com")
namespace ServiceB {
}
@client({
name: "CombineClient",
service: [ServiceA, ServiceB],
autoMergeService: true,
})
namespace CombineClient {
}