# schema-enum-no-duplicates

Source: https://api-genie.dev/docs/linter/openapi/rules/schema-enum-no-duplicates

A rule of the OpenAPI linter, which reads OpenAPI 3.0, 3.1 and 3.2 documents. Since 0.0.1. In the rulesets: Recommended at error, Strict at error, All at error.

This rule checks that no value appears twice in an `enum`.

## Rule details

A repeated value is a copy-and-paste mistake, often of a value that was meant to be another one:
`active, active` where `active, archived` was intended. Generated code for the enum then has one
member fewer than the API has values, or does not compile.

The rule reports `Duplicate enum value` on the schema.

## Examples

**Good**.

```yaml
components:
  schemas:
    UserStatus:
      type: string
      enum:
        - active
        - inactive
```

**Bad**. `active` twice.

```yaml
components:
  schemas:
    UserStatus:
      type: string
      enum:
        - active
        - active
```
