Looking to master JSON Schema for OpenAPI?

A 9+ hour course taught by a member of the JSON Schema Technical Steering Committee

exclusiveMaximum : Boolean

exclusiveMaximum

Boolean

When maximum is present and this keyword is set to true, the numeric instance must be less than the value in maximum.

Value This keyword must be set to a boolean value Hint: Use the jsonschema metaschema and jsonschema lint commands to catch keywords set to invalid values
Kind Assertion
Applies To Number
Base Dialect Draft 4
Changed In Draft 6
Introduced In Draft 3
Vocabulary Validation
Specification https://json-schema.org/draft-04/draft-fge-json-schema-validation-00#rfc.section.5.1.2
Metaschema http://json-schema.org/draft-04/schema#
Official Tests draft4/maximum.json
Default false
Annotation None
Affected By None
Affects
Also See

The exclusiveMaximum keyword is a boolean modifier for the maximum keyword. When set to true, it changes the validation behavior of the maximum keyword from less than or equal to to strictly less than. This keyword has no effect if the maximum keyword is not present in the same schema.

Remember that JSON Schema is a constraint-driven language. Therefore, non-number instances successfully validate against this keyword. If needed, make use of the type keyword to constraint the accepted type accordingly.

Examples

A schema that constrains number instances to be less than 10 Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "maximum": 10,
  "exclusiveMaximum": true
}
Valid A number value less than 10 is valid Instance
9.9
Valid An integer value less than 10 is valid Instance
9
Invalid A number value greater than 10 is invalid Instance
10.001
Invalid An integer value greater than 10 is invalid Instance
11
Invalid The real representation of the integer value 10 is invalid Instance
10.0
Invalid The integer value 10 is invalid Instance
10
Valid A non-number value is valid Instance
"100000"
A schema with exclusive semantics but no upper bound Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "exclusiveMaximum": true
}
Valid Any number value is valid Instance
10
Valid Any number value is valid Instance
999999999
A schema that explicitly constrains number instances to be less than or equal to 10 Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "maximum": 10,
  "exclusiveMaximum": false
}
Valid The integer value 10 is valid Instance
10
Valid The real representation of the integer value 10 is valid Instance
10.0
Valid A number value less than 10 is valid Instance
9.9
Invalid A number value greater than 10 is invalid Instance
10.1