Search code examples
node.jsswaggerbackend

How to handle reoccurring request parameters in swagger yaml


Is there a way to define all the reoccurring request parameters in one place as we do with schemas. For example

parameters:
- name: auth
  in: header
  description: an authorization header
  required: true
  type: string
- name: id
  in: header
  description: an special id
  required: true
  type: string

These headers are required in all APIs so please let me know if there's such a way so we don't have to write them in all the APIs. Thanks.


Solution

  • You are looking for the $ref keyword.