FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor
    Recommended

    json-schema-enum-values-compatible


    Formats: Severity:

    This rule checks that enum and const values can actually satisfy the declared type.

    Bad example

    {
      "type": "string",
      "enum": [1, 2, 3]
    }
    

    Good example

    {
      "type": "string",
      "enum": ["small", "medium", "large"]
    }
    

    How do I fix this violation?

    Align the enum or const values with the declared type.