operation-success-response
Since 0.0.1 · In the rulesets: Recommended at error, Strict at error, All at error
This rule checks that every operation declares at least one 2xx or 3xx response, as a status code
or as the 2XX or 3XX range.
Rule details
The success response is the one clients are written for: its status, its body and its headers are what a generated client returns and what a mock answers. An operation that declares only errors leaves the main case to guesswork.
The rule reports Operation must have at least one success response.
Examples
Good. A status code.
paths:
/users:
get:
responses:
"200":
description: A page of users.
Good. A range.
paths:
/users:
get:
responses:
2XX:
description: A page of users.
Bad. Only an error.
paths:
/users:
get:
responses:
"400":
description: The query is invalid.
Turn it off or change its severity
In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.rules has the details.
commands:
lint:
rules:
operation-success-response: off