From fca988b1e9db2a0c6e98ff93e28fbf755da36790 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Tue, 8 Nov 2016 11:44:45 -0800 Subject: [PATCH] Add "const" keyword for constant values. This addresses issue #58, which got quite a few upvotes and has a "draft 6" milestone. I used the shorter "const" that several people suggested rather than "constant", but obviously that's easy to change if the longer form is preferred. The wording was pretty much directly lifted from "enum". --- jsonschema-validation.xml | 10 ++++++++++ schema.json | 1 + 2 files changed, 11 insertions(+) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 817a9410..0ece2210 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -546,6 +546,16 @@ +
+ + The value of this keyword MAY be of any type, including null. + + + An instance validates successfully against this keyword if its value is + equal to the value of the keyword. + +
+
The value of this keyword MUST be either a string or an array. If it is diff --git a/schema.json b/schema.json index b31dc7ae..d44cd480 100644 --- a/schema.json +++ b/schema.json @@ -124,6 +124,7 @@ ] } }, + "const": {}, "enum": { "type": "array", "minItems": 1,