Commit 1ea50a1
authored
Fix derived model description when no public derived models (#11791)
## Summary
Fixes the C# generator description for discriminated base models whose
derived models are all non-public.
`ModelProvider.BuildDescription` now returns the model description
without appending the derived-classes sentence when there are no public
derived models. This avoids both the dangling `instantiation are:` text
and its trailing whitespace.
A regression test covers the all-internal-derived-model case.
Fixes #11769
## Validation
- Regression test failed before the fix and passes after it.
- `Microsoft.TypeSpec.Generator.Tests`: 2162 passed, 0 failed.
- `npm run build` passed.
- `eng/scripts/Generate.ps1` completed successfully.
- `npm run cop` passed (`cop checks passed.`).
- `git diff --check` passed.1 parent 45eea52 commit 1ea50a1
2 files changed
Lines changed: 22 additions & 0 deletions
File tree
- packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator
- src/Providers
- test/Providers/ModelProviders
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
| |||
0 commit comments