Skip to content

Preserve order of parameters in @Parameters annotation #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ny-currenxie opened this issue Dec 17, 2019 · 1 comment
Closed

Preserve order of parameters in @Parameters annotation #274

ny-currenxie opened this issue Dec 17, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@ny-currenxie
Copy link

ny-currenxie commented Dec 17, 2019

Refer to the reply from the issue #251 (comment). When we configure something like

 @Parameters({
         @Parameter(in = ParameterIn.QUERY
                 , description = "Page you want to retrieve (0..N)"
                 , name = "page"
                 , content = @Content(schema = @Schema(type = "integer", defaultValue = "0"))),
         @Parameter(in = ParameterIn.QUERY
                 , description = "Number of records per page."
                 , name = "size"
                 , content = @Content(schema = @Schema(type = "integer", defaultValue = "20"))),
         @Parameter(in = ParameterIn.QUERY
                 , description = "Sorting criteria in the format: property(,asc|desc). "
                 + "Default sort order is ascending. " + "Multiple sort criteria are supported."
                 , name = "sort"
                 , content = @Content(array = @ArraySchema(schema = @Schema(type = "string"))))
 })
 public @interface PageableAsQueryParam {}

the generated api-doc contains the parameters in the order

"parameters": [
          { "name": "size", ...},
          { "name": "page", ...},
          { "name": "sort",... }
        ],

Can we preserve the order as specified? By looking into the source code, seems that could be achieved by putting parameters in a LinkedHashMap in AbstractRequestBuilder.getApiParameters().

@springdoc
Copy link
Collaborator

Hi,

Thank you, it will be available on the next release: v1.2.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants