Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: OpenAPI 3 emitter incorrectly generate duplicate name error #3217

Closed
4 tasks done
allenjzhang opened this issue Apr 23, 2024 · 3 comments · Fixed by #3218
Closed
4 tasks done

[Bug]: OpenAPI 3 emitter incorrectly generate duplicate name error #3217

allenjzhang opened this issue Apr 23, 2024 · 3 comments · Fixed by #3218
Assignees
Labels
bug Something isn't working needs-area

Comments

@allenjzhang
Copy link
Member

Describe the bug

Simple model definition generates:

@typespec/openapi/duplicate-type-name
Duplicate type name: 'Foo'. Check @friendlyName decorators and overlap with types in TypeSpec or service namespace.

Reproduction

Playground link

Checklist

@allenjzhang allenjzhang added the bug Something isn't working label Apr 23, 2024
@bterlson
Copy link
Member

A slightly more minimal repro

import "@typespec/http";

using TypeSpec.Http;

@service({
  title: "Test Service",
})
namespace DemoService;
model Foo is TrackedResource {
  @path name: string;
}
model Resource {}
model TrackedResource extends Resource {}

Does not repro when without an extends chain 3 deep or more.

@timotheeguerin
Copy link
Member

the problems comes from the fact that we use Visibility.all to render the unreachable models but when figuring out if the properties are the same we use Visibility.read so Foo gets emitted with both.

@timotheeguerin
Copy link
Member

though it is weird because it is only doing that with derived models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants