Skip to main content

at-least-one-item-in-server-variable-enum-list

Overview

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

If an enumeration list is declared using the enum property it must contain at least one string-valued entry which can be used for substitution i.e. the enumeration array should not be empty.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageServer variable enum array is empty.
CodeOPENAPI3STANDARDS_L010
TypeLinting
Rule SystemSemantic
Broad CategoryServer Variables
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting enum server variable variable server

Suggested Fixes

  • If substitution options are from a limited set, add those in the enumeration list.
  • The substitution options to be added in the enumeration list must be string values.
  • If substitution options are not known beforehand or are not expected to be limited to a specific set of values, remove the enum property declaration.

For More Information