From 576b9a5722723fb9b43a3eae99fd1763ee563ea9 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Mon, 18 Jun 2018 17:37:28 -0700 Subject: [PATCH] Rename "dependencies" to "schemaDependencies" I also noticed that it was in the wrong section. As an in-place conditional applicator, it belongs with "if", "then", and "else". Not with the object child applicators. Apparently, I had not made the meta-schema changes at all. The "$comment" follows the precedent established from leaving "definitions" in the meta-schema after the rename to "$defs". --- hyper-schema.json | 2 ++ jsonschema-core.xml | 46 ++++++++++++++++++++++----------------------- schema.json | 13 +++++++++++++ 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/hyper-schema.json b/hyper-schema.json index 82cf32fa..bb2680f9 100644 --- a/hyper-schema.json +++ b/hyper-schema.json @@ -16,7 +16,9 @@ "properties": { "additionalItems": { "$ref": "#" }, "additionalProperties": { "$ref": "#"}, + "schemaDependencies": { "$ref": "#" }, "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"schemaDependencies\" and \"requiredDependencies\"", "additionalProperties": { "anyOf": [ { "$ref": "#" }, diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 893af5ae..0e079dff 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1099,18 +1099,18 @@
- These keywords work together to implement conditional - application of a subschema based on the outcome of - another subschema. + Three of these keywords work together to implement conditional + application of a subschema based on the outcome of another subschema. + The fourth is a shortcut for a specific conditional case. - These keywords MUST NOT interact with each other across + "if", "then", and "else" MUST NOT interact with each other across subschema boundaries. In other words, an "if" in one branch of an "allOf" MUST NOT have an impact on a "then" or "else" in another branch. - There is no default behavior for any of these keywords + There is no default behavior for "if", "then", or "else" when they are not present. In particular, they MUST NOT be treated as if present with an empty schema, and when "if" is not present, both "then" and "else" MUST be @@ -1181,6 +1181,23 @@ or annotation collection purposes, in such cases.
+
+ + This keyword specifies subschemas that are evaluated if the instance + is an object and contains a certain property. + + + This keyword's value MUST be an object. + Each value in the object MUST be a valid JSON Schema. + + + If the object key is a property in the instance, the entire + instance must validate against the dependency value. + + + Omitting this keyword has the same behavior as an empty object. + +
@@ -1327,24 +1344,6 @@ Omitting this keyword has the same behavior as an empty schema.
- -
- - This keyword specifies subschemas that are evaluated if the instance - is an object and contains a certain property. - - - This keyword's value MUST be an object. - Each value in the object MUST be a valid JSON Schema. - - - If the object key is a property in the instance, the entire - instance must validate against the dependency value. - - - Omitting this keyword has the same behavior as an empty object. - -
@@ -1686,6 +1685,7 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0 Moved "definitions" from the Validation specification here as "$defs" Moved applicator keywords from the Validation specification as their own vocabulary Moved "dependencies" from the Validation specification, but only the schema form + Renamed "dependencies" to "schemaDependencies" to avoid compatibility issues diff --git a/schema.json b/schema.json index 182eefb0..850b3cc7 100644 --- a/schema.json +++ b/schema.json @@ -131,7 +131,20 @@ "propertyNames": { "format": "regex" }, "default": {} }, + "schemaDependencies": { + "type": "object", + "additionalProperties": { + "$ref": "#" + } + }, + "requiredDependencies": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"schemaDependencies\" and \"requiredDependencies\"", "type": "object", "additionalProperties": { "anyOf": [