FAQ

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

    json-schema-type-constraint-compatible


    Formats: Severity:

    This rule checks that constraints line up with the schema type.

    String constraints belong with strings, numeric constraints belong with numbers and integers, array constraints belong with arrays, and object constraints belong with objects.

    Bad example

    {
      "type": "string",
      "minimum": 10
    }
    

    Good example

    {
      "type": "number",
      "minimum": 10
    }
    

    How do I fix this violation?

    Move the constraint to a schema with a compatible type, or change the declared type.