I am writing an OpenAPI definition for my API.
I am using components for responses, but Swagger Editor shows an error when I try to reference these components:
What is the correct way to reference response components?
I am writing an OpenAPI definition for my API.
I am using components for responses, but Swagger Editor shows an error when I try to reference these components:
What is the correct way to reference response components?
The correct way to reference response components is:
responses:
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
That is, responses is a map (not an array/list) where the keys are HTTP status codes and the values are response definitions.