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]: @removed decorator for a property won't work directly, if a model is not added from the very begining #3210

Closed
4 tasks done
qiaozha opened this issue Apr 23, 2024 · 1 comment · Fixed by #3409
Closed
4 tasks done
Assignees
Labels
bug Something isn't working triaged:core
Milestone

Comments

@qiaozha
Copy link
Member

qiaozha commented Apr 23, 2024

Describe the bug

enum Versions {
  v1,
  v2,
  v3
}

@added(Versions.v2)
model Foo {
  prop: string;

  // @add(Versions.v2) // if I comment it out, it won't work
  @removed(Versions.v3)
  prop2: int32;
}

this will report

error
@typespec/versioning/incompatible-versioned-reference
'DemoService.Foo' was added in version 'v2' but contains type 'DemoService.Foo.prop2' added in version 'v1'.
22:3

Does @removed mean being removed since some version ? If so, I don't see why we need to add the @add decorator to remove a property.

Reproduction

playground link

Checklist

@qiaozha qiaozha added the bug Something isn't working label Apr 23, 2024
@markcowl markcowl added this to the [2024] June milestone Apr 29, 2024
@markcowl
Copy link
Contributor

Note that, if you mark the property with @added(Versions.V2) then this issue can be worked around

@tjprescott tjprescott self-assigned this Apr 30, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue Apr 30, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue Apr 30, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue May 8, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue May 21, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue May 21, 2024
(cherry picked from commit 5093f97)
github-merge-queue bot pushed a commit that referenced this issue May 21, 2024
…ning (#3409)

Fixes #3210

While the issue was for model properties, it also applies to interfaces,
so tests are included for both.

---------

Co-authored-by: Timothee Guerin <[email protected]>
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