at-least-one-response-code-in-responses
Overview
This rule belongs to the swagger-v2-standards-validation
ruleset and states that:
The Responses Object must contain at least one response code which is recommended to be the response for a successful operation call.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Responses Object is empty. |
Code | SWAGGER20STANDARDS_V180 |
Type | Validation |
Rule System | Semantic |
Broad Category | Responses |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | swagger2 swagger standards semantic validation responses response |
Suggested Fixes
- Ensure that your Responses Object contains at least one entry.
- If you are looking to add a single entry it should represent the expected status code when the current request/operation on the API service is successful.
- If you are unsure, add 200 as the response code and define its corresponding Response Object.
- Ensure that the entry uses a valid HTTP status code or use 'default' instead.
- The Responses Object is expected to cover important successful responses and error cases.