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.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Default value provided for the server variable is invalid. |
| Code | OPENAPI3STANDARDS_V032 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Server Variables |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 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.