Repository navigation
Use PascalCase for generated C# extensible enum members - #12623
Jorge Rangel (jorgerangel-msft) wants to merge 11 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
commit: |
|
No changes needing a change description found. |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The URL rewrite can break backward compatibility by dropping published enum members, while numeric-suffixed names such as HTTP2 and UTF8 still bypass casing normalization.
2 open issues
What changed in this PR
Updates the C# generator to use PascalCase for non-exact extensible enum members, addressing #12602 while aiming to preserve existing API names and serialized values.
Changes:
- Normalizes uppercase words before removing separators, turning
NOT_FOUNDintoNotFound. - Integrates normalization with existing enum naming and compatibility handling.
- Adds tests for uppercase names, acronyms, exact names, and unchanged serialized values.
| File | Description |
|---|---|
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/EnumProviders/EnumProviderTests.cs |
Adds member-casing and serialized-value assertions. |
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ExtensibleEnumProvider.cs |
Enables uppercase normalization for extensible enums. |
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/EnumProvider.cs |
Integrates optional normalization into member-name generation. |
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/Extensions/StringExtensions.cs |
Adds regex-based uppercase-word normalization. |
Review effort: Balanced
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The normalization pattern still leaves two-letter enum members with numeric suffixes, such as VM2 and IO2, all-uppercase and needs a fix with regression coverage while preserving the IPV4/IPV6 exceptions.
1 open issue
2 resolved since last review
Review effort: Balanced
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
regen preview Azure/azure-sdk-for-net#65104 |


The C# generator can emit extensible enum members in all caps, such as
ANDandOR. Generated names should follow .NET PascalCase conventions unless the member is markedexact.NOT_FOUNDbecomesNotFound.