OpenAPITools / OpenAPITools/openapi-generator
[REQ] [java] [client] skip SingleRequestParameter model where endpoint has only one parameter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Many apologies if this is already requested elsewhere, I looked but couldn't find.
REQ - Is it possible to skip or make optional the SingleRequestParameter @BeanParam model where the endpoint only has one parameter, while retaining the SingleRequestParameter @BeanParam model if the endpoint has more than one parameter ?
Rationale
- We typically might design an API to manage a resource where we end up with ten endpoints, of which nine have only one parameter (usually a @PathParam), eg GET
/my-resources/{uuid}, PUT/my-resources/{uuid}/tags, etc., but one has many many parameters (typically @QueryParam on an endpoint that supports search over that resource collection - GET/my-resources/?filter[byX]&filter[byY]&filter[byZ]&page[endCursor]&page[size]...). - For the search endpoint the SingleRequestParameter is a godsend with respect to both usage in client code, and server implementation (we use
java/microprofileon both client and server - but I guess this maybe a more general case). - For the other nine endpoints we end up with a generated wrapper @BeanParam object that contains a single parameter (usually the resource id) and this complicates code unnecessarily. Instead of a simple method signature
getMyResource(aUuid)on the client side we now havegetMyResource(new getMyResource().uuid(aUuid)), and have to take a little more care with NPEs and so on when unwrapping on the server side.
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 the Java/MicroProfile generation path for SingleRequestParameter and the generated @BeanParam models, comparing endpoints with one parameter against endpoints with several parameters. Define the expected client and server method signatures and identify the relevant generated-output tests before determining whether the request can be implemented consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100