How to specify same path params at a single place for multiple endpoints in a swagger.yaml file

Viewed 6

I have 3 end points start, stop, status that looked like this

paths:
  /users:
    # other endpoint
  /containers/{vendorID}/{pluginID}/{artifactID}/start:
      parameters:
        - in: path
          name: vendorID
          required: true
          type: string
        - in: path
          name: pluginID
          required: true
          type: string
        - in: path
          name: artifactId
          required: true
          type: string
      get:
        # get related stuff
  /containers/{vendorID}/{pluginID}/{artifactID}/stop:
    parameters:
        - in: path
          name: vendorID
          required: true
          type: string
        - in: path
          name: pluginID
          required: true
          type: string
        - in: path
          name: artifactId
          required: true
          type: string
    get:
      # get related stuff
  /containers/{vendorID}/{pluginID}/{artifactID}/status:
    parameters:
        - in: path
          name: vendorID
          required: true
          type: string
        - in: path
          name: pluginID
          required: true
          type: string
        - in: path
          name: artifactId
          required: true
          type: string
    get:
      # get related stuff

All the endpoints start, stop, status has the same parameters but i ended up duplicating it at 3 different places. I am using swagger 2.0 but openApi3.0 is also welcome. Is there a way that I can specify these path params at one place and use it at other places ?

Thank you.

0 Answers
Related