OpenAPITools / OpenAPITools/openapi-generator
[REQ] Provide option to generate QueryParameter from model types in JavaSpring generator
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.
I have this definition of request parameter in openapi xml
- in: query
name: listQueryParams
required: true
schema:
$ref: '#/components/schemas/ListQueryParams'
When I generate API (generator: spring) from this file the generated API interface does not have an annotation @QueryParameter on the method parameter.
As I see in the modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache the @QueryParameter is only added if isModel is false.
Describe the solution you'd like
Models should also be used as query parameters so the annotation @QueryParameters should be generated then, too.
Describe alternatives you've considered
Only alternative is to create a POST endpoint and use the query parameters object as body.
Additional context
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 with modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache and inspect how model and non-model query parameters are rendered. Generate a JavaSpring API from the provided OpenAPI shape and verify that the model query parameter receives the requested annotation in the generated interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100