From e256bcae6e865f2d41181613181659dda417318d Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:16:22 -0800 Subject: [PATCH 1/8] contractions are a little less formal --- jsonschema-core.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 2bacfd2a..f8548d69 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1632,7 +1632,7 @@ When schemas are downloaded, - for example by a generic user-agent that doesn't know until runtime which schemas to download, + for example by a generic user-agent that does not know until runtime which schemas to download, see Usage for Hypermedia. @@ -3083,7 +3083,7 @@ https://example.com/schemas/common#/$defs/count/minimum Instances and schemas are both frequently written by untrusted third parties, to be deployed on public Internet servers. - Validators should take care that the parsing and validating against schemas doesn't consume excessive + Validators should take care that the parsing and validating against schemas does not consume excessive system resources. Validators MUST NOT fall into an infinite loop. @@ -3093,7 +3093,7 @@ https://example.com/schemas/common#/$defs/count/minimum excessive consumption of system resources in such a scenario. - Servers MUST ensure that malicious parties can't change the functionality of + Servers MUST ensure that malicious parties cannot change the functionality of existing schemas by uploading a schema with a pre-existing or very similar "$id". From de85e51d844e4a89252caaae88889b54398c1764 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:19:00 -0800 Subject: [PATCH 2/8] unevaluated* is now in its own vocabulary, so move some references accordingly ..also added mention of "contains" dependence on "minContains" (specifically when its value is 0) --- jsonschema-core.xml | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index f8548d69..6f887da5 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2083,17 +2083,11 @@ "additionalProperties", whose behavior is defined in terms of "properties" and "patternProperties" - - "unevaluatedProperties", whose behavior is defined in terms of - annotations from "properties", "patternProperties", - "additionalProperties" and itself - "items", whose behavior is defined in terms of "prefixItems" - "unevaluatedItems", whose behavior is defined in terms of annotations - from "prefixItems", "items", "contains", and itself + "contains", whose behavior is defined in terms of "minContains" @@ -2521,6 +2515,26 @@ before the next to indicate the same syntax and semantics as those listed here. + +
+ + Schema keywords typically operate independently, without + affecting each other's outcomes. However, the keywords in this + vocabulary are notable exceptions: + + + "unevaluatedItems", whose behavior is defined in terms of annotations + from "prefixItems", "items", "contains", and itself + + + "unevaluatedProperties", whose behavior is defined in terms of + annotations from "properties", "patternProperties", + "additionalProperties" and itself + + + +
+
The value of "unevaluatedItems" MUST be a valid JSON Schema. @@ -2530,7 +2544,7 @@ adjacent keywords that apply to the instance location being validated. Specifically, the annotations from "prefixItems", "items", and "contains", which can come from those keywords when they are adjacent to the - "unevaluatedItems" keyword. Those two annotations, as well as + "unevaluatedItems" keyword. Those three annotations, as well as "unevaluatedItems", can also result from any and all adjacent in-place applicator keywords. This includes but is not limited to the in-place applicators @@ -3644,10 +3658,10 @@ https://example.com/schemas/common#/$defs/count/minimum keywords in that vocabulary, is shown after the main example meta-schema. - The main example meta-schema also restricts the usage of the Applicator + The main example meta-schema also restricts the usage of the Unevaluated vocabulary by forbidding the keywords prefixed with "unevaluated", which are particularly complex to implement. This does not change the semantics - or set of keywords defined by the Applicator vocabulary. It just ensures + or set of keywords defined by the other vocabularies. It just ensures that schemas using this meta-schema that attempt to use the keywords prefixed with "unevaluated" will fail validation against this meta-schema. @@ -3682,7 +3696,7 @@ https://example.com/schemas/common#/$defs/count/minimum {"$ref": "https://example.com/meta/example-vocab", ], "patternProperties": { - "^unevaluated.*$": false + "^unevaluated": false }, "properties": { "localKeyword": { From 328c0b23f8a9a538665995760fe95c7a96883ef2 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:23:55 -0800 Subject: [PATCH 3/8] it is no longer the evaluator's responsibility to combine annotations similar changes were made in #787. --- jsonschema-core.xml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 6f887da5..a4fd6563 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2374,10 +2374,7 @@ The annotation result of this keyword is the set of instance - property names matched by this keyword. Annotation results - for "properties" keywords from multiple schemas applied to - the same instance location are combined by taking the union - of the sets. + property names matched by this keyword. Omitting this keyword has the same assertion behavior as @@ -2400,10 +2397,7 @@ The annotation result of this keyword is the set of instance - property names matched by this keyword. Annotation results - for "patternProperties" keywords from multiple schemas applied to - the same instance location are combined by taking the union - of the sets. + property names matched by this keyword. Omitting this keyword has the same assertion behavior as @@ -2430,9 +2424,6 @@ The annotation result of this keyword is the set of instance property names validated by this keyword's subschema. - Annotation results for "additionalProperties" keywords from - multiple schemas applied to the same instance location are combined - by taking the union of the sets. Omitting this keyword has the same assertion behavior as @@ -2613,9 +2604,6 @@ The annotation result of this keyword is the set of instance property names validated by this keyword's subschema. - Annotation results for "unevaluatedProperties" keywords from - multiple schemas applied to the same instance location are combined - by taking the union of the sets. Omitting this keyword has the same assertion behavior as From af9009b36820dfcdfba1fd2b198df34b86b6bae7 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:25:10 -0800 Subject: [PATCH 4/8] clarify the requirements to implement the different output formats --- jsonschema-core.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index a4fd6563..d8d4864f 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2650,10 +2650,10 @@ structure that matches the exact structure of the schema. - An implementation SHOULD provide at least the "flag", "basic", or "detailed" + An implementation SHOULD provide at least one of the "flag", "basic", or "detailed" format and MAY provide the "verbose" format. If it provides one or more of the - complex formats, it MUST also provide the "flag" format. Implementations SHOULD - specify in their documentation which formats they support. + "detailed" or "verbose" formats, it MUST also provide the "flag" format. + Implementations SHOULD specify in their documentation which formats they support.
From 713c353b9f6541748bf107ccafc256940a9bfde5 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:26:06 -0800 Subject: [PATCH 5/8] soften wording on absoluteKeywordLocation it is not strictly true that there will *always* be a fragment in this field: an error might occur at the schema resource root itself (for example if the subschema is "false") --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index d8d4864f..0d713ddd 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2706,7 +2706,7 @@ Note that "absolute" here is in the sense of "absolute filesystem path" (meaning the complete location) rather than the "absolute-URI" terminology from RFC 3986 (meaning with scheme but without fragment). - Keyword absolute locations will always have a fragment in order to + Keyword absolute locations will have a fragment in order to identify the keyword. From 9e96dda6c71697afc459b812aabc084ae75eef58 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:27:55 -0800 Subject: [PATCH 6/8] clarify "relative location" wording keywordLocation does not always contain a relative location that actually exists in a schema - because of reference navigation, its path contains keywords from multiple locations --- jsonschema-core.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 0d713ddd..262fb7ef 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2718,8 +2718,8 @@ https://example.com/schemas/common#/$defs/count/minimum - This information MAY be omitted only if either the relative location contains - no references or if the schema does not declare an absolute URI as its "$id". + This information MAY be omitted only if either the dynamic scope did not pass + over a reference or if the schema does not declare an absolute URI as its "$id". The JSON key for this information is "absoluteKeywordLocation". From f21d2b3df5e099561edfe5c1b0ec2140b1e3ac21 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:28:50 -0800 Subject: [PATCH 7/8] capitalize words for emphasis, per RFC 2119 --- jsonschema-core.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 262fb7ef..371a6b4d 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -3601,9 +3601,9 @@ https://example.com/schemas/common#/$defs/count/minimum behavior is undefined. - Vocabulary authors should provide a meta-schema that validates the + Vocabulary authors SHOULD provide a meta-schema that validates the expected usage of the vocabulary's keywords on their own. Such meta-schemas - should not forbid additional keywords, and must not forbid any + SHOULD not forbid additional keywords, and MUST not forbid any keywords from the Core vocabulary. From 8cdaf1acb9223921ee73ac89c9020358d8b8bce1 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Dec 2020 10:58:41 -0800 Subject: [PATCH 8/8] evaluation does not always begin at a root schema resource for example, if we start evaluating at "https://foo.com/schema.json#/$defs/Foo" and /$defs/Foo does not contain an $id keyword --- jsonschema-core.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 371a6b4d..f4bd28ab 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -656,8 +656,9 @@ Other keywords may take into account the dynamic scope that exists during the evaluation of a schema, typically together - with an instance document. The outermost dynamic scope is the - root schema of the schema document in which processing begins. + with an instance document. + The outermost dynamic scope is the schema object at + which processing begins, even if it is not a schema resource root. The path from this root schema to any particular keyword (that includes any "$ref" and "$dynamicRef" keywords that may have been resolved) is considered the keyword's "validation path."