exclusiveMinimum : Number

exclusiveMinimum

Number

Validation succeeds if the numeric instance is greater than the given number.

Kind Assertion
Applies To Number
Dialect 2020-12
Introduced In Draft 3
Vocabulary Validation
Specification https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.2.5
Metaschema https://json-schema.org/draft/2020-12/meta/validation
Also see

The exclusiveMinimum keyword is used to set an exclusive lower limit on numeric instances. It specifies that the numeric value being validated must be strictly greater than (not equal to) the provided minimum value.

  • Applies only to number data types (integers and real numbers).
  • Validation succeeds if the number is strictly greater than the specified exclusiveMinimum.

Examples

Schema defining exclusive lower limit of 5 on numeric values Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "number",
  "exclusiveMinimum": 5
}
An instance with numeric value less than 5 is invalid Instance
3
An instance with numeric value greater than 5 is valid Instance
9.5
An instance with numeric value equal to 5 is invalid Instance
5
Schema allowing either a string value or a numeric value with an exclusive lower limit of 10.2 Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": [ "string", "number" ],
  "exclusiveMinimum": 10.2
}
An instance with a numeric value greater than 10.2 is valid Instance
15
An instance with a boolean datatype is invalid Instance
false
An instance with a string value is valid Instance
"Hello World!"
An instance with a numeric value less than 10.2 is invalid Instance
10.01
Schema with both 'minimum' and 'exclusiveMinimum' keywords Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "number",
  "exclusiveMinimum": 10,
  "minimum": 5
}
An instance with numeric value greater than 10 is valid Instance
15
An instance with numeric value less than or equal to 10 is invalid Instance
9.5
  • Note: Here, the exclusiveMinimum takes precedence, even though minimum is 5. Only numbers greater than 10 are valid.