Skip to content

Support TCGC exact() client name in C# emitter#10728

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/support-exact-client-name
Draft

Support TCGC exact() client name in C# emitter#10728
Copilot wants to merge 2 commits into
mainfrom
copilot/support-exact-client-name

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

TCGC 0.68.0 added exact(), which marks a @clientName value to be preserved verbatim by emitters. This change plumbs the new isExactName flag through the C# emitter and generator so that marked names bypass .ToIdentifierName() casing.

model Book {
  @clientName(Azure.ClientGenerator.Core.exact("snake_case_name"), "csharp")
  name: string;
}
// Generated C#: public string snake_case_name { get; set; }

Changes

  • TypeScript emitter — Added optional isExactName?: boolean to InputModelType, InputEnumType, InputLiteralType, InputUnionType, and InputPropertyTypeBase. Populated from the corresponding SDK types in type-converter.ts, operation-converter.ts, and client-converter.ts.
  • Generator.Input — Added IsExactName to the InputType and InputProperty base classes and extended the JSON converters (model, enum, literal, union, model property, and method/header/query/path/body/endpoint parameter) to deserialize the field.
  • Generator providersModelProvider.BuildName, EnumProvider.BuildName, and PropertyProvider skip .ToIdentifierName() when IsExactName is true.
  • Tests — New PropertyProviderTests cases for exact-name model and property; emitter model-type.test.ts cases verifying propagation from exact() on both a property and a model, plus a negative case.

Copilot AI linked an issue May 19, 2026 that may be closed by this pull request
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/b465cdf8-5db5-43ea-97f0-f615be72ddc1

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label May 19, 2026
Copilot AI changed the title [WIP] Add support for exact client name in emitter Support TCGC exact() client name in C# emitter May 19, 2026
Copilot AI requested a review from jorgerangel-msft May 19, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Exact Client Name

2 participants