unique-schema-enum-list-items
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
If property enum
is specified in the Schema Object, it must consist of only unique items in the list.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Enumeration list item is already defined. |
Code | OPENAPI3STANDARDS_L151 |
Type | Linting |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting enum schema |
Suggested Fixes
- Remove redundant/duplicate entries from the enumeration list.
- Enumeration items are compared in a case-sensitive manner.
- Ensure that all the items in the list are unique.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.1.2
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.20
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/