operation-success-response
Check every Operation Response has either a 2xx
or 3xx
response code.
An operation isn’t much use, unless it returns an OK status code (2xx
), or a Redirect/Choice status code (3xx
)
Why did this violation appear?
There is an Operation Response in your specification that isn’t returning a success response.
What is this rule checking for?
Every Operation Response is checked for the following:
- 2xx or 3xx Response code
A good example.
"/pet":
post:
responses:
'200':
description: New pet was added, great job.
A bad example.
"/pet":
post:
responses:
'500':
description: It can only go wrong from here.
How do I fix this violation?
Ensure all operations return at least one 2xx
or 3xx
response.
Spectral Equivalent
The rule is equivalent to operation-success-response