exclusiveMinimum : Number

exclusiveMinimum

Number

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

Value This keyword must be set to a 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
Official Tests draft2020-12/exclusiveMinimum.json
Default None
Annotation None
Affected By None
Affects None
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
}
Invalid An instance with numeric value less than 5 is invalid Instance
3
Valid An instance with numeric value greater than 5 is valid Instance
9.5
Invalid 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
}
Valid An instance with a numeric value greater than 10.2 is valid Instance
15
Invalid An instance with a boolean datatype is invalid Instance
false
Valid An instance with a string value is valid Instance
"Hello World!"
Invalid 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
}
Valid An instance with numeric value greater than 10 is valid Instance
15
Invalid 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.