Skip to main content

valid-response-http-status-code

Overview

This rule belongs to the swagger-v2-syntax-validation ruleset and states that:

The Responses Object key must be a valid HTTP status code or set to 'default'. The key must be enclosed in quotation marks for compatibility between JSON and YAML. If the key is an explicit status code, then it must be valid according to RFC7231 and possibly listed in the registered status codes in the IANA Status Code Registry.

PropertyValue
EnabledYes
Maximum SeverityError
MessageInvalid HTTP status code found.
CodeSWAGGER20SYNTAX_V040
TypeValidation
Rule SystemSyntax
Broad CategoryResponses
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger syntax validation http status status code code http status responses response

Suggested Fixes

  • Make sure that the value of the HTTP status code is enclosed in single or double quotation marks.
  • Ensure that the HTTP status code is valid and falls in the range 1XX - 5XX.

For More Information