swagger-api / swagger-api/swagger-codegen-generators
[Java generator] Generate various overloads for functions when some arguments are optional
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Assume you have an endpoint search with arguments:
- searchString - required
Java generator will generate something like:
public SearchPreview search(String searchString)
When I add an optional argument int limit to the endpoint, the Java generator will generate
public SearchPreview search(String searchString, int limit)
All the clients using the original search(String searchString) will no longer work. They will have to change their code to use the new function because swagger generator does not generate a search overload without the optional parameters.
It would be great if both methods would be available:
public SearchPreview search(String searchString)
public SearchPreview search(String searchString, int limit)
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 the Java generator's method-generation path and trace how endpoint arguments become generated client methods. Confirm the behavior for an endpoint with one required and one optional argument; done means both the original single-argument overload and the overload including the optional argument are generated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100