Skip to main content

valid-server-variable-default-value-for-enum

Overview

This rule belongs to the openapi-v3-standards-validation ruleset and states that:

If a default value is provided for the server variable and an enumeration list is also defined using the enum property, the default value must exist in this list.

PropertyValue
EnabledYes
Maximum SeverityError
MessageDefault value provided for the server variable is invalid.
CodeOPENAPI3STANDARDS_V032
TypeValidation
Rule SystemSemantic
Broad CategoryServer Variables
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic validation default value enum value server variable variable server

Suggested Fixes

  • The default value is compared in a case-sensitive manner with the values from the enumeration list.
  • If the default value is valid, consider adding an entry for it in the enumeration list.
  • Ensure that the default value matches exactly with an entry from the enumeration list.

For More Information