OpenAPITools / OpenAPITools/openapi-generator
[REQ][JAVA] Support method overloading
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
A lot of parameters in requests bodies can be optional. Currently, the Java generators generate method signatures with all of the parameters in the parameter list, requiring the caller to null unneeded parameters. This is fine for a handful of parameters, but sometimes there could be tens of them, making this very tedious.
AppListResponse listResponse = apiInstance.listApps(null, null);
Describe the solution you'd like
Support for method overloading. So a method would have different signatures available to call. In the above case, where there are two optional parameters, a caller would be able to call:
apiInstance.listApps();
apiInstance.listApps(null);
apiInstance.listApps(null, null);
Describe alternatives you've considered
Another alternative would be to have parameter bags or classes for providing the parameters.
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
The issue names no files, tests, or entry points. Start by locating the Java generator's method-signature generation path and its tests, using the listApps examples as expected behavior; done means generated clients provide overloads for optional parameters without requiring unnecessary null arguments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100