From e104106b0ad24b2d2498258928e1fd249d048e9f Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Wed, 21 Feb 2024 23:14:48 +0530 Subject: [PATCH] add description and examples for maximum keyword --- content/2020-12/validation/maximum.markdown | 47 +++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/content/2020-12/validation/maximum.markdown b/content/2020-12/validation/maximum.markdown index 619235c0..fe25519e 100644 --- a/content/2020-12/validation/maximum.markdown +++ b/content/2020-12/validation/maximum.markdown @@ -18,3 +18,50 @@ related: - vocabulary: validation keyword: multipleOf --- + +The `maximum` keyword is used to set the upper limit on numeric instances. It specifies that the numeric value being validated must be less than or equal to the provided maximum value. + +* Applies only to number data types (integers and floats). +* Validation succeeds if the number is less than or equal to the specified `maximum`. + +## Examples + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number", + "maximum": 10 +} +{{}} + +{{}} +9.5 +{{}} + +{{}} +15 +{{}} + +{{}} +10 +{{}} + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": [ "boolean", "number" ], + "maximum": 20 +} +{{}} + +{{}} +15 +{{}} + +{{}} +"Hello World!" +{{}} + +{{}} +true +{{}}