Skip to content

multiple-param-alias

Id
@azure-tools/typespec-client-generator-core/multiple-param-alias

Severity: warning

This diagnostic is issued when more than one @paramAlias is applied to the same model property in the same effective scope.

  • Area: Client initialization parameter naming. Generation continues using the first alias, while later aliases for the same scoped parameter are ignored.
  • Not affected: Operation-level parameter names and wire names are unchanged.
model ClientOptions {
account: string;
}
@@paramAlias(ClientOptions.account, "accountName");
@@paramAlias(ClientOptions.account, "storageAccountName"); // second alias for the same parameter scope

TCGC reports:

Multiple param aliases applied to 'account'. Only the first one 'accountName' will be used.

Keep only one alias for the property in a given scope, or scope the aliases so only one applies to each emitter.

model ClientOptions {
account: string;
}
@@paramAlias(ClientOptions.account, "accountName");

This diagnostic should not be suppressed. Fix the @paramAlias usage so each parameter has a single alias.