This rule ensures that schema objects do not have duplicate values in their
enum or const properties.
Duplicate values can lead to confusion and misinterpretation of the API’s structure.
The schema-enum-no-duplicates rule is designed to ensure that all schema
objects do not have duplicate values in their enum or const properties.
The rule works by iterating over all the schema objects and checking if their
enum or const properties have duplicate values. If a duplicate value
is found, the rule raises a warning.
None.
Good.
components:
schemas:
UserStatus:
type: string
enum:
- active
- inactive
Bad.
components:
schemas:
UserStatus:
type: string
enum:
- active
- active
We recommend to always enable this rule.
This rule is compatible with all OpenAPI 3.x versions.