microsoft / microsoft/typespec
[Bug]: Issues using Versioning decorators with operations
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
A service team is trying to use version to describe changes to an operation signature. The following arguable _should_ work, but throws errors:
```tsp
@added(Versions.v2)
model MyOptions {
blah: string;
}
@removed(Versions.v2)
@put
op foo(): Foo;
@added(Versions.v2)
@put
op foo(...MyOptions): Foo;
```
1) The first issue is the re-use of the name `foo`. It seems intuitive that the name is not actually duplicated, because the first `foo` exists only in v1 and the second only in v2. But maybe there's a good technical reason why we can't allow that, so you can just change them to `fooOld` and `fooNew`... but THEN...
2) You get a "duplicate operation routed at" _error_ and are blocked. You can't realistically make them point to different routes because the whole point is it is the same operation.
So it seems like the errors around routes and maybe around names needs to take versioning into account.
### Reproduction
https://cadlplayground.z22.web.core.windows.net/?c=aW1wb3J0ICJAdHlwZXNwZWMvdmVyc2lvbmluZyI7DQrSIGh0dHDEGg0KdXNpbmcgVskwO8gTSHR0cMUiQHNlcnZpY2Uoew0KICBuYW1lOiAiRGVtbyBTxhkiLA0KfSkNCkDHdmVkKMdQcykNCsQxc3BhY2UgxDTFUmVudW3Ic3MgxVd2MSzFBzLETMQkbW9kZWwgRm9vxiDGd3N0cuYAo8UjQGFkZMtsLnYyKcg4TXlPcHTKXmJsYWjRPnJlbW920UBAcHV0DQpvcCBmb28oKTrkAILmAQbUbc0tLi4uyXfJOQ%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D
### Checklist
- [X] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [X] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Assessment
This issue has not been assessed yet.