at-least-one-operation-4XX-response
Overview
This rule belongs to the openapi-v3-apimatic-linting
ruleset and states that:
An operation should have at least one 4XX response defined to indicate that an error may be returned by the API. Please check the responses section of the operation and ensure that at least one 4XX response is properly defined. It is recommended to provide a detailed description of the error in the response message to help clients understand the issue.
Property | Value |
---|---|
Enabled | No |
Maximum Severity | Warning |
Message | Operation does not contain a 4XX response. |
Code | OPENAPI3APIMATIC_L462 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI Responses |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi apimatic semantic linting operation error 4XX |
Suggested Fixes
- Check that the responses section of the operation is properly defined.
- Ensure that at least one 4XX response is defined for the operation.
- Verify that the 4XX response has a properly formatted schema and a detailed description of the error.
- Use HTTP status codes in the 4XX range, such as 400, 401, 404, 409, etc. to indicate the type of error that may be returned.