Skip to content

Path-level parameters should be listed before operation-level parameters #7482

Open
swagger-api/swagger-js
#2256
@hkosova

Description

@hkosova

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Chrome, Firefox latest
  • Method of installation: https://editor.swagger.io
  • Swagger-UI version: 3.52.0
  • Swagger/OpenAPI version: any

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  title: test
  version: 0.0.0
paths:
  /something/{id}:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
    get:
      parameters:
        - in: query
          name: foo
          schema:
            type: string
      responses:
        '200':
          description: ok

Describe the bug you're encountering

In the API definition provided above, the /something/{id} path has path-level parameter id, plus the GET operation defines an additional parameter foo.

Swagger UI renders the path-level parameter id AFTER the operation-level parameters foo. This is often undesirable because path-level parameter list often contains in: path parameters (which are required), so it makes more sense to render path-level parameters first.

To reproduce...

Steps to reproduce the behavior:

  1. Paste the sample API definition into https://editor.swagger.io.
  2. Expand the operation.

Expected behavior

Parameter order is: id first, then foo.

Actual behavior

Parameter order is: foo, id.

Screenshots

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions