Skip to content

wrong-client-decorator

Id
@azure-tools/typespec-client-generator-core/wrong-client-decorator

Severity: warning

This diagnostic is issued when @client is applied through an augment decorator instead of directly on a namespace or interface in client.tsp.

  • Area: Explicit client declaration. Generation continues, but the augmented @client application is ignored because clients must be declared directly.
  • Not affected: The namespace or interface itself remains in the TypeSpec program.
@service
namespace ServiceNamespace;
namespace ClientNamespace {
}
@@client( // `@client` cannot be applied as an augment decorator
ClientNamespace,
{
service: ServiceNamespace,
}
);

TCGC reports:

@client should decorate namespace or interface in client.tsp

Place @client directly on the namespace or interface declaration that represents the client:

@service
namespace ServiceNamespace;
@client({
service: ServiceNamespace,
})
namespace ClientNamespace {
}

Suppress this warning only during a migration where an augmented @client is intentionally ignored and another valid client declaration is used instead.

#suppress "@azure-tools/typespec-client-generator-core/wrong-client-decorator" "augmented @client intentionally ignored"