swagger-api / swagger-api/swagger-client
V2 Compatibility mode doesn't work for tag interface
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 765
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 6
Description
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}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/execute/index.js and trace how getOperationRaw resolves the operation ID through opId. Review the unit tests added in pull request #1283, then add coverage for calling client.apis.tag.get_some_path_id with a route parameter. Done means the call resolves to /some/path/{id} and buildRequest succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100