[http-client-csharp] Preserve ApiCompat acronym names after namespace updates - #11701
Merged
JoshLove-msft merged 3 commits intoAug 17, 2026
Merged
Conversation
Restore last-contract model and enum names after namespace visitors move generated types, and retain input metadata for enum compatibility lookup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 887e1959-8449-4a09-b284-47a81837f172
JoshLove-msft
requested review from
Jorge Rangel (jorgerangel-msft),
Jose Arriaga Maldonado (joseharriaga),
Jesse Squire (jsquire) and
m-nash
as code owners
August 17, 2026 17:48
commit: |
Contributor
|
No changes needing a change description found. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the http-client-csharp generator’s ApiCompat name preservation so that previously-shipped acronym casing (from ApiCompatVersion last-contract baselines) is still honored even after namespace relocation visitors move generated types.
Changes:
- Extend
TypeProviderlast-contract lookup to fall back from the normalized generated name to the original input identifier name when the difference is only supported acronym normalization. - Ensure enum providers retain input metadata for the above fallback by flowing the input type into the
TypeProviderbase. - Add regression tests covering model property and enum name preservation after namespace updates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/ModelProviderTests.cs | Adds a regression test for model/property back-compat name preservation after a namespace update. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/EnumProviders/EnumProviderTests.cs | Adds a regression test for enum back-compat name preservation after a namespace update. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/TypeProvider.cs | Implements acronym-aware fallback when resolving last-contract views and uses last-contract name to stabilize identity after updates. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/EnumProvider.cs | Passes enum input type into TypeProvider so last-contract fallback has access to original names. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Avoid redundant last-contract lookup when acronym normalization is unchanged and give namespace-update regressions dedicated baseline assets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 887e1959-8449-4a09-b284-47a81837f172
Jorge Rangel (jorgerangel-msft)
approved these changes
Aug 17, 2026
JoshLove-msft
enabled auto-merge
August 17, 2026 19:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 887e1959-8449-4a09-b284-47a81837f172
JoshLove-msft
disabled auto-merge
August 17, 2026 19:05
Jorge Rangel (jorgerangel-msft)
approved these changes
Aug 17, 2026
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
Fixes #11696