Skip to content
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

Order of parameters not respected #1165

Closed
ivansenic opened this issue Jun 28, 2022 · 1 comment · Fixed by #1274
Closed

Order of parameters not respected #1165

ivansenic opened this issue Jun 28, 2022 · 1 comment · Fixed by #1274

Comments

@ivansenic
Copy link

The order of parameters defined in the @Parameters is no respected.. This results in a crazy order, especially in a Swagger UI and is very confusing for a user imo.

For example, having the:

  @Parameters(
      value = {
        @Parameter(name = "namespace", ref = OpenApiConstants.Parameters.NAMESPACE),
        @Parameter(name = "collection", ref = OpenApiConstants.Parameters.COLLECTION),
        @Parameter(name = "where", ref = OpenApiConstants.Parameters.WHERE),
        @Parameter(name = "fields", ref = OpenApiConstants.Parameters.FIELDS),
        @Parameter(
            name = "page-size",
            in = ParameterIn.QUERY,
            description = "The max number of results to return.",
            schema =
                @Schema(
                    implementation = Integer.class,
                    defaultValue = "3",
                    minimum = "1",
                    maximum = "20")),
        @Parameter(name = "page-state", ref = OpenApiConstants.Parameters.PAGE_STATE),
        @Parameter(name = "profile", ref = OpenApiConstants.Parameters.PROFILE),
        @Parameter(name = "raw", ref = OpenApiConstants.Parameters.RAW),
      })

will result in the following order in the openapi.json

      parameters:
      - name: page-size
        in: query
        description: The max number of results to return.
        schema:
          format: int32
          default: "100"
          minimum: 1
          type: integer
      - $ref: '#/components/parameters/collection'
      - $ref: '#/components/parameters/document-id'
      - $ref: '#/components/parameters/fields'
      - $ref: '#/components/parameters/namespace'
      - $ref: '#/components/parameters/page-state'
      - $ref: '#/components/parameters/profile'
      - $ref: '#/components/parameters/raw'
      - $ref: '#/components/parameters/where'

and eventually looking like this in Swagger UI:

image

MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Sep 29, 2022
Closes smallrye#1165

Signed-off-by: Michael Edgar <michael@xlate.io>
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Sep 30, 2022
Closes smallrye#1165

Signed-off-by: Michael Edgar <michael@xlate.io>
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Sep 30, 2022
Closes smallrye#1165

Signed-off-by: Michael Edgar <michael@xlate.io>
@ivansenic
Copy link
Author

@MikeEdgar Thanks for the fix 👍 Any idea when is this released and included in Quarkus?

MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue Oct 14, 2022
Closes smallrye#1165

Signed-off-by: Michael Edgar <michael@xlate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant