Recommended

typed-enum


Formats: Severity:

Enum definitions should match specified types

Why did this violation appear?

One or more enum values do not match the specified type.

Bad example

enum is supposed to be an array of string, but gets a mixed array.

/pizza:
 parameters:
  - in: query
    name: "party"
    schema:
     type: "string"
     enum: ["big", 1, 0.33, false, "small"]
     ...

Good Example

/pizza:
 parameters:
  - in: query
    name: "party"
    schema:
     type: "string"
     enum: ["big", "small"]
     ...

How do I fix this violation?

Ensure that enum values match specified types.

Spectral Equivalent

The rule is equivalent to typed-enum