Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageResponses Object is empty.
CodeSWAGGER20STANDARDS_V180
TypeValidation
Rule SystemSemantic
Broad CategoryResponses
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 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.

For More Information