Skip to content
Last updated

no-enum-type-mismatch

Requires that the contents of every enum value in your API description conform to the corresponding schema's specified type.

OASCompatibility
2.0
3.0
3.1
3.2

components

Root

Paths

PathItem

Operation

Parameter

Schema

NamedParameters

RequestBody

MediaType

Responses

NamedSchemas

components

Root

Paths

PathItem

Operation

Parameter

Schema

NamedParameters

RequestBody

MediaType

Responses

NamedSchemas

AsyncAPICompatibility
2.6
3.0
ArazzoCompatibility
1.0

API design principles

If a property is defined for a certain type, then its corresponding enum values should comply with that type. Lack of compliance is most likely the result of a typo.

Configuration

OptionTypeDescription
severitystringPossible values: off, warn, error. Default error (in recommended configuration).

An example configuration:

rules:
  no-enum-type-mismatch: error

Examples

Given this configuration:

rules:
  no-enum-type-mismatch: error

Example of incorrect enum values given the enum type:

properties:
  huntingSkill:
    type: string
    description: The measured skill for hunting
    enum:
      - adventurous
      - 12
      - 3.14

Example of correct enum values given the enum type:

properties:
  huntingSkill:
    type: string
    description: The measured skill for hunting
    enum:
      - adventurous
      - aggressive
      - passive

Resources