swagger-api / swagger-api/swagger-codegen
Pass parameters as an object for get operations with too many params
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
We have GET operations with 15-20 or more parameters. The API client code generated for these has methods with a large number of parameters.
Collapsing these parameters into a POJO and pass that in to the API method would make the code easier to maintain.
Swagger-codegen version
Pulled in the latest code from master on 2016.10.11.
Swagger declaration file content or url
Command line used for generation
We are using the Java client.
Steps to reproduce
This is a feature request, not a bug.
Related issues
I didn't see a related issue.
Suggest a Fix
I added a variable to swagger spec file called "x-paramCollapseThreshold".
If this parameter exists with a positive value, the get operations with more params than that have a POJO with setters generated. An instance of this class is passed to the GET API method.
I want to see if I should make this a pull request if this is something others are interested in.
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 by tracing Java client generation and how the Swagger declaration is read for the proposed x-paramCollapseThreshold setting. Done means GET operations above the threshold receive a generated parameter POJO with setters and accept that object, while operations below it retain their current signatures; no file or test is identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100