Maximum and exclusivemaximum - sgpinkus/json-schema GitHub Wiki

THIS WIKI IS OBSOLETE. PLEASE SEE THE NEW JSON-SCHEMA-ORG/JSON-SCHEMA-SPEC REPOSITORY.



Description

A numeric instance is valid with regards to maximum if it is lower than, or equal to, this keyword's value. If exclusiveMaximum is also present and its value is boolean value true, then the numeric instance must be strictly lower than the value in maximum.

Valid values

The value of maximum MUST be a number. The value of exclusiveMaximum MUST be a boolean.

If exclusiveMaximum is present, then maximum MUST be present.

If maximum is present but not exclusiveMaximum, it MAY be considered that the exclusiveMaximum keyword value is boolean false.

Examples

Against this schema:

{
    "maximum": 4,
    "exclusiveMaximum": true
}

the following instances are valid:

  • 3.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;
  • -642.14;

the following instances are invalid:

  • 4;
  • 4.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001;
  • 5.
⚠️ **GitHub.com Fallback** ⚠️