Update OpenAPI3 emitter for shared routes#1770
Conversation
|
Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status): Website: https://cadlwebsite.z1.web.core.windows.net/prs/1770/ |
|
You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/1770/ Check the website changes at https://cadlwebsite.z1.web.core.windows.net/prs/1770/ |
3e370a9 to
acc6d94
Compare
1387dd5 to
6564487
Compare
|
@johanste I updated the PR to allow params to differ by location. The key logic that is reflected in the tests occurs in openapi.ts lines 422:465 (validateCommonParameters). Please scrutinize that heavily and let me know if there are other scenarios I should handle or if I'm handling existing ones incorrectly. |
|
Is there documentation for how this works? |
markcowl
left a comment
There was a problem hiding this comment.
This looks good, a couple of suggestions for additional tests
nguerrera
left a comment
There was a problem hiding this comment.
Minor comment about sorting. I looked only at the test cases, not the implementation but that was all I found about the test cases.
f314450 to
9ca0c35
Compare
|
It looks like some operations may be silently discarded if routes are shared. Playground Example where operation "bar" is silently discarded. |
|
9a69838 to
13e0de2
Compare
6e3ecfb to
44f6bd2
Compare
44f6bd2 to
0f5ef7d
Compare
| * @param path Relative route path. Cannot include query parameters. | ||
| * @param parameters Optional set of parameters used to configure the route. Supports `{shared: true}` which indicates that the route may be shared by several operations. | ||
| */ | ||
| extern dec route(entity: unknown, path: string, parameters?: object); |
There was a problem hiding this comment.
Same comment as on @daviwil PR, parameters should be typed
alias RouteOptions = {
shared?: boolean
}
Closes #1198.