Skip to content

duplicate-client-name-warning

Id
@azure-tools/typespec-client-generator-core/duplicate-client-name-warning

Severity: warning

This diagnostic is issued when two generated SDK declarations share the same client name. This is by design for languages such as C# that use the duplicated name to produce overloads.

  • Area: C# SDK naming and overload generation. Generation continues, but the duplicate generated name should be intentional for C# overload behavior.
  • Not affected: Other language scopes are unaffected unless the same duplicate name applies to them.
interface StorageTasks {
@route("/list")
list(): void;
@clientName("list", "csharp") // duplicates the C# client name of `list`
@route("/listByParent")
listByParent(parent: string): void;
}

TCGC reports:

Client name: "list" is duplicated in language scope: "csharp"

Give listByParent a distinct C# client name, or suppress the warning if the duplicate intentionally represents an overload.

interface StorageTasks {
@route("/list")
list(): void;
@clientName("listByParent", "csharp")
@route("/listByParent")
listByParent(parent: string): void;
}

TCGC reports:

Client name: "list" is defined somewhere causing naming conflicts in language scope: "csharp"

Rename one of the generated operations for the affected scope, or suppress the warning when the duplicate is an intentional overload.

Suppress this warning only when the duplicate generated name is intentional for the target emitter, such as a C# overload.

#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Intentional overload for C#"