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