Skip to main content

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.

PropertyValue
EnabledNo
Maximum SeverityWarning
MessageOperation does not contain a 4XX response.
CodeOPENAPI3APIMATIC_L462
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Responses
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 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.

For More Information