Skip to main content

at-least-one-entry-in-parameter-enum-list

Overview

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

If an enumeration list is declared using the enum property for the parameter, it must contain at least one element which can be used for substitution i.e. the enumeration array must not be empty.

PropertyValue
EnabledYes
Maximum SeverityError
MessageParameter enum array is empty.
CodeSWAGGER20STANDARDS_V119
TypeValidation
Rule SystemSemantic
Broad CategoryParameters
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger standards semantic validation enum parameter arrays json schema validation json schema

Suggested Fixes

  • Ensure that the enum array is not empty.
  • 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