Skip to content

Global parameters not visible when referenced through other definition. #5667

Description

@bilak

Q&A (please complete the following information)

Content & configuration

Example Swagger/OpenAPI definition:

file: /openapi/openapi.yaml

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT

paths:
  /pets/{petId}:
    $ref: ./petstore.yaml#/paths/~1pets~1{petid}

file: /openapi/petstore.yaml

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT

paths:
  /pets/{petId}:
    parameters:
      - $ref: '#/components/parameters/PetIdPathParam'
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - $ref: '#/components/parameter/PetIdPathParam'
      responses:
        '200':
          description: ok
    options:
      summary: show problem with parameter not displayed
      operationId: showPetById
      tags:
        - pets
      responses:
        '200':
          description: ok
          
components:
  parameters:
    PetIdPathParam:
      - in: path
        name: petId
        required: true
        description: The id of the pet to retrieve
        schema:
          type: string

Swagger-UI configuration options:
file: /openapi/swagger-ui-config.json

{
  "urls": [
  {
    "name": "petstore.yaml",
    "url": "/openapi/petstore.yaml"
  },
  {
    "name": "openapi.yaml",
    "url": "/openapi/openapi.yaml"
  }
  ],
  "urls.primaryName": "openapi.yaml"
}
?configUrl=/openapi/swagger-ui-config.json

Describe the bug you're encountering

I have one openapi.yaml from which I'm referencing paths from other files. When remote path has global parameter (see PetIdPathParam definition in petstore.yaml) this parameter is not visible through referenced url (e.g. when looking at openapi.yaml from swagger-ui -> in this case OPTIONS does not have param.
When I switch to petstore.yaml parameters are visible in both methods (get and options) even when options doesn't define PetIdPathParam.

To reproduce...

Steps to reproduce the behavior:
use definitions added tho this issue

Expected behavior

if global url parameters are defined, they should be displayed as if they were added directly to method

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions