at-least-one-entry-in-schema-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 schema object, it must contain at least one element which can be used for substitution i.e. the enumeration array must not be empty.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Schema Object enum array is empty. |
| Code | SWAGGER20STANDARDS_V313 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Schemas |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | swagger2 swagger standards semantic validation enum schema arrays json schema validation json schema |
Suggested Fixes
- Ensure that the
enumarray 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
enumproperty declaration.