exclusiveMinimum : Number
exclusiveMinimum
NumberValidation 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 |
Changed In | Draft 6 |
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": "https://json-schema.org/draft/2020-12/schema",
"type": "number",
"exclusiveMinimum": 5
}
3
9.5
5
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": [ "string", "number" ],
"exclusiveMinimum": 10.2
}
15
false
"Hello World!"
10.01
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "number",
"exclusiveMinimum": 10,
"minimum": 5
}
15
9.5
- Note: Here, the
exclusiveMinimum
takes precedence, even thoughminimum
is 5. Only numbers greater than 10 are valid.