Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Update exclusive* keywords specification #66

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions source/reference/numeric.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,44 +146,52 @@ Range
'''''

Ranges of numbers are specified using a combination of the
``minimum``, ``maximum``, ``exclusiveMinimum`` and
``exclusiveMaximum`` keywords.
``minimum`` and ``maximum`` keywords (or ``exclusiveMinimum`` and
``exclusiveMaximum`` for expressing exclusive range).

- ``minimum`` specifies a minimum numeric value.
- ``minimum`` specifies an inclusive lower limit for a numeric instance,
i.e., :math:`x \ge\mathrm{min}`.

- ``exclusiveMinimum`` specifies an exclusive lower limit for a numeric instance,
i.e., :math:`x > \mathrm{min}`.

- ``exclusiveMinimum`` is a boolean. When ``true``, it indicates that
the range excludes the minimum value, i.e., :math:`x >
\mathrm{min}`. When ``false`` (or not included), it indicates that
the range includes the minimum value, i.e., :math:`x \ge
\mathrm{min}`.

- ``maximum`` specifies a maximum numeric value.

- ``exclusiveMaximum`` is a boolean. When ``true``, it indicates that
the range excludes the maximum value, i.e., :math:`x <
\mathrm{max}`. When ``false`` (or not included), it indicates that
the range includes the maximum value, i.e., :math:`x \le
\mathrm{max}`.
- ``maximum`` specifies an inclusive upper limit for a numeric instance,
i.e., :math:`x \le\mathrm{max}`.

- ``exclusiveMaximum`` specifies an exclusive upper limit for a numeric
instance. , i.e., :math:`x < \mathrm{max}`.

.. schema_example::
{
"type": "number",
"minimum": 0,
"maximum": 100,
"exclusiveMaximum": true
"maximum": 100
}
--X
// Less than ``minimum``:
-1
--
// ``exclusiveMinimum`` was not specified, so 0 is included:
// ``minimum`` is inclusive, so 0 is valid:
0
--
10
--
99
--X
// ``exclusiveMaximum`` is ``true``, so 100 is not included:
// ``maximum`` is inclusive, so 100 is valid:
100
--X
// Greater than ``maximum``:
101

.. schema_example::
{
"type": "number",
"minimum": 0,
"exclusiveMaximum": 100
}
--X
// ``exclusiveMaximum`` is exclusive, so 100 is not valid:
100
--X
// Greater than ``maximum``:
Expand Down