Skip to content

invalid-client-service-multiple

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

Severity: error

This diagnostic is issued when @client is applied to an interface with multiple services in the service option.

  • Area: Multi-service client declaration. Blocks using an interface as the root for a client that merges multiple services; only namespaces can represent that structure.
  • Not affected: The referenced service namespaces remain valid.
@service namespace ServiceA;
@service namespace ServiceB;
@client({ service: [ServiceA, ServiceB] }) // multiple services are not allowed on an interface client
interface CombinedClient {}

TCGC reports:

`@client` with multiple services is only allowed on `Namespace`.

Move the multi-service @client declaration to a namespace, or use a single service for an interface client.

@service namespace ServiceA;
@service namespace ServiceB;
@client({ service: [ServiceA, ServiceB] })
namespace CombinedClient {}