I want almost all of my paths to have the following 3 generic error responses. How to describe this in Swagger without copying these lines everywhere?
401: description: The requester is unauthorized. schema: $ref: '#/definitions/Error' 500: description: "Something went wrong. It server fault." schema: $ref: '#/definitions/Error' 503: description: Server is unavailable. Maybe there is maintenance? schema: $ref: '#/definitions/Error'
An example of how I use this in a query:
paths: /roles: get: summary: Roles description: | Returns all roles available for users. responses: 200: description: An array with all roles. schema: type: array items: $ref: '#/definitions/Role' 401: description: The requester is unauthorized. schema: $ref: '#/definitions/Error' 500: description: "Something went wrong. It server fault." schema: $ref: '#/definitions/Error' 503: description: Server is unavailable. Maybe there is maintenance? schema: $ref: '#/definitions/Error'
source share