Skip to main content

at-least-one-response-code-in-responses

Overview

This rule belongs to the openapi-v3-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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageResponses Object is empty.
CodeOPENAPI3STANDARDS_V196
TypeValidation
Rule SystemSemantic
Broad CategoryResponses
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi 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/range or use 'default' instead.
  • The Responses Object is expected to cover important successful responses and error cases.

For More Information