Fix derived model description when no public derived models - #11791
Merged
JoshLove-msft merged 1 commit intoSep 3, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the C# generator’s model XML doc description for discriminated base models when all derived models are non-public, avoiding a dangling “derived classes available for instantiation are:” sentence (and trailing whitespace).
Changes:
- Update
ModelProvider.BuildDescriptionto skip appending the derived-classes sentence when there are no public derived models. - Add a regression test covering the “all derived models are internal” scenario.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Providers/ModelProvider.cs | Skips the derived-classes sentence in the description when publicDerivedModels is empty. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/ModelProviderTests.cs | Adds a regression test for discriminated base models with only non-public derived models. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
JoshLove-msft
approved these changes
Sep 3, 2026
JoshLove-msft
enabled auto-merge
September 3, 2026 05:11
commit: |
Contributor
|
No changes needing a change description found. |
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
Fixes the C# generator description for discriminated base models whose derived models are all non-public.
ModelProvider.BuildDescriptionnow returns the model description without appending the derived-classes sentence when there are no public derived models. This avoids both the danglinginstantiation are:text and its trailing whitespace.A regression test covers the all-internal-derived-model case.
Fixes #11769
Validation
Microsoft.TypeSpec.Generator.Tests: 2162 passed, 0 failed.npm run buildpassed.eng/scripts/Generate.ps1completed successfully.npm run coppassed (cop checks passed.).git diff --checkpassed.