at-least-one-success-response-exists
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
The Responses Object must contain at least one response code which should be the response for a successful operation call e.g. 200.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | No success response definition found in the responses list. |
Code | OPENAPI3STANDARDS_L101 |
Type | Linting |
Rule System | Semantic |
Broad Category | Responses |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting success status code response |
Suggested Fixes
- Add an entry in the responses list for the default success response code of your operation/endpoint e.g. 200. If other success status codes and their definitions are well-known, add their entries too.
- The successful response codes belong to the HTTP status code range of 2XX e.g. 200, 201, etc.
- If all success responses possible for your operation share the same structure, you can define them once using the status code range 2XX instead of defining with an explicit code.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#responses-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#http-status-codes
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responses-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#http-status-codes
- https://www.rfc-editor.org/rfc/rfc7231#section-6
- https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/