OpenAPITools / OpenAPITools/openapi-generator

[REQ] Support for @SpringQueryMap in spring-cloud

Open
#9,681 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Could you please add support for @SpringQueryMap for @GetMapping if parameter is type of Object?

Support for:

generator: spring
library: spring-cloud

Example:
ResponseEntity<List<Client>> findClients(@NotNull @SpringQueryMap @ApiParam(value = "Client filter object", required = true) @Valid ClientFilter filter);
Propsed solution:

Change JavaSpring/queryParams.mustache to

{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} {{#isExplode}}{{#isDeepObject}}@org.springframework.cloud.openfeign.SpringQueryMap{{/isDeepObject}}{{/isExplode}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}}

This code snippet adds support for serialize object as query parameters

{{#isExplode}}{{#isDeepObject}}@org.springframework.cloud.openfeign.SpringQueryMap{{/isDeepObject}}{{/isExplode}}

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with JavaSpring/queryParams.mustache for the spring generator and compare its handling of object parameters with the @GetMapping example in the issue. Update the template so the requested SpringQueryMap annotation is generated for exploded deep-object query parameters, then verify the generated declaration matches the proposed output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.