From 26a89499cc8bfc5811a83c4f4f302e4f95bca325 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sun, 18 Feb 2024 18:54:12 +0530 Subject: [PATCH] add description and examples for exclusiveMaximum keyword --- .../validation/exclusiveMaximum.markdown | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/content/2020-12/validation/exclusiveMaximum.markdown b/content/2020-12/validation/exclusiveMaximum.markdown index 7d6c5470..c218dba0 100644 --- a/content/2020-12/validation/exclusiveMaximum.markdown +++ b/content/2020-12/validation/exclusiveMaximum.markdown @@ -18,3 +18,69 @@ related: - vocabulary: validation keyword: multipleOf --- + +The `exclusiveMaximum` keyword is used to set an exclusive upper limit on numeric instances. It specifies that the numeric value being validated must be strictly less than (not equal to) the provided maximum value. + +* Applies only to number data types (integers and floats). +* Validation succeeds if the number is strictly less than the specified `exclusiveMaximum`. + +## Examples + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number", + "exclusiveMaximum": 10 +} +{{}} + +{{}} +15 +{{}} + +{{}} +9.5 +{{}} + +{{}} +10 +{{}} + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": [ "string", "number" ], + "exclusiveMaximum": 20 +} +{{}} + +{{}} +15 +{{}} + +{{}} +true +{{}} + +{{}} +"Hello World!" +{{}} + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number", + "exclusiveMaximum": 10, + "maximum": 20 +} +{{}} + +{{}} +9.5 +{{}} + +{{}} +15 +{{}} + +* _**Note:** Here, the `exclusiveMaximum` takes precedence, even though `maximum` is 20. Only numbers less than 10 are valid._ \ No newline at end of file