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

Versioned mixin properties cannot be used in a versioned model #3639

Open
markcowl opened this issue Jun 21, 2024 Discussed in #3455 · 0 comments
Open

Versioned mixin properties cannot be used in a versioned model #3639

markcowl opened this issue Jun 21, 2024 Discussed in #3455 · 0 comments
Labels
Milestone

Comments

@markcowl
Copy link
Contributor

Discussed in #3455

Originally posted by rrevo May 26, 2024
The Typespec file below does not compile

import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";

using TypeSpec.Versioning;

@versioned(Versions)
@service({
  title: "Widget Service",
})
namespace DemoService;

enum Versions {
  v1,
  v2,
  v3
}

using TypeSpec.Http;
using TypeSpec.Rest;

model Widget {
  color: "red" | "blue";
  @added(Versions.v2) name: string;  // FAIL
}

@added(Versions.v3)
model Widget3 is Widget {
  fancyField: string
}

with the failure
'DemoService.Widget3' was added in version 'v3' but contains type 'DemoService.Widget3.name' added in version 'v2'.

I wanted to model v1 followed by v2 followed by v3. However based on how I've declared the models, it looks like v2 and v3 are considered independent.

How can this versioning dependency be resolved? Or is it a bug in Typespec?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant