swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.48k stars 8.96k forks source link

Path as reference with parameters are ignored #6931

Open fabssor opened 3 years ago

fabssor commented 3 years ago

Q&A

Content & configuration

Example Swagger/OpenAPI definition: Main File:

...
  /users/{userId}:
    $ref: ./paths/Usermanagment/usersUserId.yaml
...

included File via ref

parameters:
  - in: path
    name: userId
    schema:
      $ref: './components/schemas.yaml#/userId'
    required: true
    description: Unique numeric ID of the user to get
    example: userid12
get:
  tags:
    - User Management
...

Swagger-UI configuration options: No options are used, just the plain container is started with

docker run -p 80:8080 -e SWAGGER_JSON=/tmp/swagger.yaml -v $(pwd):/tmp swaggerapi/swagger-ui

Describe the bug you're encountering

If a path object is referenced the common parameters of the path are not displayed in the swagger-ui.

To reproduce...

Steps to reproduce the behavior:

  1. create a main file.
  2. Reference a path object (see above), which has common parameters for the path
  3. See the error in the swagger-ui. The parameter is not shown...

Expected behavior

The parameter is shown.

Screenshots

image

Additional context or thoughts

  1. I also tested this with redoc. He shows the parameter correctly.
  2. Also if I resolve all references in the main file via a cli tool (speccy) and create one file the parameters are shown correctly again.
SuhwanJee commented 3 months ago

any progress on this issue?

kopapageorgiou commented 3 weeks ago

I have the same issue whether the path ref exists in the same file or not. Any updates?