From 5e9deba546a2bc96daf6b7a5d1d30f744b62f768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Gonz=C3=A1lez?= Date: Fri, 23 Nov 2018 04:40:43 +0100 Subject: [PATCH 1/2] Added new "requiredProperties" keyword to supersede the "required" keyword. --- jsonschema-validation.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 82730ef7..6786ac5a 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -462,6 +462,34 @@ Omitting this keyword has the same behavior as an empty array. + + This keyword should be deprecated. + + + + +
+ + The value of this keyword MUST be either a boolean or an array. + If it is an array, elements of this array, if any, MUST be strings, + and MUST be unique. + + + If this keyword is an array, an object instance is valid against this + keyword if every item in the array is the name of a property in the + instance. + + + If this keyword has boolean value true, and the "properties" keyword is + present in the same subschema, an object instance is valid against this + keyword if for every name within the "properties" keyword's value a + property with the same name is present in the instance. + + + Omitting this keyword, setting this keyword with boolean value false, + or setting this keyword with boolean value true when the "properties" + keyword is not present in the same subschema, has the same behavior as + an empty array.
From e1090fbc2bab635abdb61ddeac91305b5e551412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Gonz=C3=A1lez?= Date: Sat, 24 Nov 2018 09:54:42 +0100 Subject: [PATCH 2/2] Updated schema to include the new "requiredProperties" keyword --- schema.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/schema.json b/schema.json index f64d6636..b58ba252 100644 --- a/schema.json +++ b/schema.json @@ -119,7 +119,16 @@ "contains": { "$recursiveRef": "#" }, "maxProperties": { "$ref": "#/$defs/nonNegativeInteger" }, "minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" }, - "required": { "$ref": "#/$defs/stringArray" }, + "required": { + "$comment": "This keyword is deprecated, schema authors should use \"requiredProperties\" instead", + "$ref": "#/$defs/stringArray" + }, + "requiredProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#/$defs/stringArray" } + ] + }, "additionalProperties": { "$recursiveRef": "#" }, "properties": { "type": "object",