Skip to content

[Bug]: [http-server-csharp] model that extends another model with no additional properties are not emitted as C# class #9011

@k117117117

Description

@k117117117

Describe the bug

Subject says it all
I describe the bug in Reproduction section

library versions
PS F:\Dev\typespec-issue> npm list
typespec-issue@0.1.0 F:\Dev\typespec-issue
├── @typespec/compiler@1.6.0
├── @typespec/http-server-csharp@0.58.0-alpha.22
├── @typespec/http@1.6.0
├── @typespec/openapi@1.6.0
├── @typespec/openapi3@1.6.0
└── @typespec/rest@0.76.0

Reproduction

main.tsp

import "@typespec/http";

using Http;
@service(#{ title: "FooBarBaz Service" })
namespace DemoService;

model Foo {
  id: int32;
  name: string;
}

model Bar extends Foo {
  code: string;
}

model Baz extends Foo {}

interface FooBarBazService {
  @route("/foo/{id}") @get
  getFoo(id: int32): Foo;
}

model Baz should be emitted as Baz.cs, but not be emitted
Image

I think model Baz should be emitted as Baz.cs into generated/models/Baz.cs, like this
Image
because I want to write some code in handwritten partial class

Checklist

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions