Skip to main content

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

Overview

This rule belongs to the openapi-v3-standards-linting 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 should exist in this list.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageDefault value provided for the server variable is invalid.
CodeOPENAPI3STANDARDS_L011
TypeLinting
Rule SystemSemantic
Broad CategoryServer Variables
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting 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