[http-client-csharp] Normalize Url suffixes on operations and enum values - #11642
Merged
JoshLove-msft merged 3 commits intoAug 13, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1c88ef06-4775-4cc2-9a4c-8c807b1d23c4
JoshLove-msft
requested review from
Jorge Rangel (jorgerangel-msft),
Jose Arriaga Maldonado (joseharriaga),
Jesse Squire (jsquire) and
m-nash
as code owners
August 12, 2026 18:58
commit: |
Contributor
|
No changes needing a change description found. |
Copilot started reviewing on behalf of
Jorge Rangel (jorgerangel-msft)
August 12, 2026 19:56
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Normalizes generated C# identifiers by replacing a complete Url suffix with Uri for operation names and enum value names, while preserving isExactName values and retaining names from the last contract to avoid breaking changes in the http-client-csharp generator.
Changes:
- Added
ReplaceUrlSuffixWithUristring helper and unit tests for suffix normalization behavior. - Updated enum value name generation (fixed + extensible) to apply
Url→Urinormalization unless preserved by exact-name or last-contract matching. - Updated client operation name cleaning to apply
Url→Urinormalization unless preserved by exact-name or last-contract method names; refreshed related golden test data.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/Extensions/StringExtensions.cs | Adds ReplaceUrlSuffixWithUri helper used by generator naming. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/test/StringExtensionsTests.cs | Adds tests covering Url→Uri suffix replacement cases. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/EnumProvider.cs | Centralizes enum value generated-name logic and applies suffix normalization with last-contract preservation. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/FixedEnumProvider.cs | Uses shared generated-name logic for fixed enums (including suffix normalization/back-compat). |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ExtensibleEnumProvider.cs | Uses shared generated-name logic for extensible enums (including suffix normalization/back-compat). |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/EnumProviders/EnumProviderTests.cs | Adds coverage for enum value suffix normalization and last-contract preservation. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/EnumProviders/TestData/EnumProviderTests/BuildEnumType_PreservesUrlSuffixFromLastContract(Fixed)/MockInputEnum.cs | New last-contract test stub for fixed enum preserving Url suffix. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/EnumProviders/TestData/EnumProviderTests/BuildEnumType_PreservesUrlSuffixFromLastContract(Extensible)/MockInputEnum.cs | New last-contract test stub for extensible enum preserving Url suffix. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs | Applies Url→Uri normalization to operation names with last-contract preservation. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs | Adds tests for operation name normalization and last-contract preservation. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestOperationNamePreservesUrlSuffixFromLastContract/TestClient.cs | New last-contract client stub to validate preserving GetUrl names. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/TestData/RestClientProviderTests/TestBuildCreateRequestMethodWithSlashQueryInPath.cs | Updates golden output to reflect ...FromUri... naming. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/TestData/RestClientProviderTests/TestBuildCreateRequestMethodWithQueryInPath.cs | Updates golden output to reflect ...FromUri... naming. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1c88ef06-4775-4cc2-9a4c-8c807b1d23c4
Jorge Rangel (jorgerangel-msft)
approved these changes
Aug 13, 2026
Draft
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Related to Azure/azure-sdk-for-net#61945