This rule checks whether operations define responses for standard HTTP codes only, as described in RFC 9110.
Defining responses for non-standard codes can lead to confusion and interoperability issues in the API’s structure.
The standard-response-codes
rule is designed to ensure that operations
define responses for standard HTTP codes only, as described in RFC 9110.
The rule works by iterating over all the operations defined in the schema and checking if they define responses for any non-standard HTTP codes. If such a response is found, the rule raises a warning.
None.
Good.
paths:
/users:
get:
responses:
"200":
description: OK
"400":
description: Bad Request
"404":
description: Not Found
Bad.
paths:
/users:
get:
responses:
"200":
description: OK
"460":
description: Non-standard Code
You may turn this rule off for for internal APIs.
This rule is compatible with all OpenAPI 3.x versions.