Skip to content

[http-server-csharp] Emit C# class for models extending another model with no additional properties#10175

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-emission-of-baz-model
Open

[http-server-csharp] Emit C# class for models extending another model with no additional properties#10175
Copilot wants to merge 3 commits intomainfrom
copilot/fix-emission-of-baz-model

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

isEmptyResponseModel treats any model with zero own properties as empty, skipping emission entirely. This means model Baz extends Foo {} never produces a Baz.cs file, even though it's a meaningful derived type users may want to extend via partial classes.

model Foo { id: int32; name: string; }
model Baz extends Foo {}  // No Baz.cs emitted

Changes

  • packages/http-server-csharp/src/lib/utils.ts: isEmptyResponseModel now checks !model.baseModel before treating zero-property models as empty — derived models are always emitted.
  • packages/http-server-csharp/test/generation.test.ts: Added test case verifying a model extending another with no additional properties produces a class file with correct inheritance.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix emission issue for Baz model in C# classes [http-server-csharp] Emit C# class for models extending another model with no additional properties Mar 27, 2026
Copilot AI requested a review from markcowl March 27, 2026 02:44
@markcowl markcowl marked this pull request as ready for review March 28, 2026 00:10
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-server-csharp@10175

commit: 3e7ebed

@github-actions
Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-server-csharp
Show changes

@typespec/http-server-csharp - fix ✏️

Emit C# class for models that extend another model with no additional properties

@azure-sdk
Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants