at-least-one-item-in-server-variable-enum-list
Overview
This rule belongs to the openapi-v3-standards-validation 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 must not be empty.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Server variable enum array is empty. |
| Code | OPENAPI3STANDARDS_V031 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Server Variables |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation 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
enumproperty declaration.