swagger-js
swagger-js copied to clipboard
V2 Compatibility mode doesn't work for tag interface
Q&A (please complete the following information)
- OS: Windows 11
- Environment: Edge 127
- Method of installation: npm
- Swagger-Client version: 3.28.2
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Swagger-Client usage:
const client = SwaggerClient({url: url, v2OperationIdCompatibilityMode: true})
Describe the bug you're encountering
v2OperationIdCompabilityMode doesn't actually work, it creates the correctly named interface functions within 'client.apis' but when making a request it fails to resolve the operation ID to an endpoint within the spec.
It seems to be because the v2 compatibility flag isn't passed to getOperationRaw and then down to opId (where the flag is handled).
Looking at the unit tests that were added it seems they only check that the tag function is created not that the request actually succeeds.
To reproduce...
Steps to reproduce the behavior:
- Have a path that contains a route parameter (/some/path/{id})
- Ensure v2 compatibility mode is on
- Try to call client.apis.tag.get_some_path_id
- buildRequest throws as getOperationRaw cannot resolve the operation ID to a spec path
Expected behavior
The call is correctly translated to a request to /some/path/{id}