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

Duplicate type name error from model extending another model with visibility #2922

Closed
bterlson opened this issue Feb 16, 2024 · 0 comments · Fixed by #3049
Closed

Duplicate type name error from model extending another model with visibility #2922

bterlson opened this issue Feb 16, 2024 · 0 comments · Fixed by #3049
Assignees
Labels
bug Something isn't working triaged:core
Milestone

Comments

@bterlson
Copy link
Member

Best described by example (playground

import "@typespec/http";

using TypeSpec.Http;
@service({
  title: "Widget Service",
  version: "1.0.0",
})
namespace DemoService;

model Widget {
  @visibility("read", "update")
  @path
  id: string;

  weight: int32;
  color: "red" | "blue";
}

model CreatedWidget extends Widget {

}

@route("/widgets")
@tag("Widgets")
interface Widgets {

  // This works
  // @route("create1")
  // @post create1(widget: Widget): Widget;

  // this doesn't (also the error is not the best)
  // but if you have both of these, it works again
  @route("create2")
  @post create2(widget: Widget): CreatedWidget;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants