From 6df9b8c6a8f6bb4f6f4dc85f6d1531f6441bd5aa Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 31 May 2021 14:30:11 -0700 Subject: [PATCH 1/5] mention that annotations from these keywords affect unevaluated* --- jsonschema-core.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index e6b5476e..e9253601 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2318,6 +2318,7 @@ positions within the instance array, it produces an annotation result of boolean true, indicating that all remaining array elements have been evaluated against this keyword's subschema. + This annotation affects the behavior of "unevaluatedItems". Omitting this keyword has the same assertion behavior as @@ -2354,6 +2355,7 @@ the subschema validates successfully when applied to every index of the instance. The annotation MUST be present if the instance array to which this keyword's schema applies is empty. + This annotation affects the behavior of "unevaluatedItems". @@ -2373,7 +2375,9 @@ The annotation result of this keyword is the set of instance property names matched by this keyword. - + This annotation affects the behavior of "additionalProperties" and + "unevaluatedProperties". + Omitting this keyword has the same assertion behavior as an empty object. @@ -2396,7 +2400,9 @@ The annotation result of this keyword is the set of instance property names matched by this keyword. - + This annotation affects the behavior of "additionalProperties" and + "unevaluatedProperties". + Omitting this keyword has the same assertion behavior as an empty object. @@ -2422,6 +2428,7 @@ The annotation result of this keyword is the set of instance property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties". Omitting this keyword has the same assertion behavior as @@ -2559,6 +2566,7 @@ positions within the instance array, it produces an annotation result of boolean true, analogous to the behavior of "items". + This annotation affects the behavior of "unevaluatedItems" in parent schemas. Omitting this keyword has the same assertion behavior as @@ -2602,6 +2610,7 @@ The annotation result of this keyword is the set of instance property names validated by this keyword's subschema. + This annotation affects the behavior of "unevaluatedProperties" in parent schemas. Omitting this keyword has the same assertion behavior as From b6d3b098655e8d1864828a4c9b46ed8e61d01fdd Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 31 May 2021 14:37:53 -0700 Subject: [PATCH 2/5] remove remaining uses of "production" RFC3339 refers to these as "formats". The XML xs:NCName specification refers to it as a "type". --- jsonschema-core.xml | 2 +- jsonschema-validation.xml | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index e9253601..8552bc85 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -1417,7 +1417,7 @@ a letter ([A-Za-z]) or underscore ("_"), followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), and periods ("."). This matches the US-ASCII part of XML's - NCName production. + NCName type. Note that the anchor string does not include the "#" character, as it is not a URI-reference. An "$anchor": "foo" becomes the diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index b8d68d69..beb22e4f 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -701,30 +701,34 @@ A string instance is valid against this attribute if it is - a valid representation according to the "date-time" production. - + a valid "date-time" representation according to the specification + referenced above + A string instance is valid against this attribute if it is - a valid representation according to the "full-date" production. - + a valid "full-date" representation according to the specification + referenced above + A string instance is valid against this attribute if it is - a valid representation according to the "full-time" production. - + a valid "full-time" representation according to the specification + referenced above + A string instance is valid against this attribute if it is - a valid representation according to the "duration" production. - + a valid "duration" representation according according to the + specification referenced above + Implementations MAY support additional attributes using the other - production names defined anywhere in that RFC. If "full-date" or "full-time" + format names defined anywhere in that RFC. If "full-date" or "full-time" are implemented, the corresponding short form ("date" or "time" respectively) MUST be implemented, and MUST behave identically. Implementations SHOULD NOT define extension attributes - with any name matching an RFC 3339 production unless it validates - according to the rules of that production. + with any name matching an RFC 3339 format unless it validates + according to the rules of that format. There is not currently consensus on the need for supporting all RFC 3339 formats, so this approach of reserving the From 7ec8df10f9d3ec7ff546699ae2e2ecd9b13e5147 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 31 May 2021 14:52:43 -0700 Subject: [PATCH 3/5] rewording of sections on "contains", "maxContains", "minContains" - More cross-references added that note the dependence of these keywords on each other - Validation algorithm provided that does not rely on annotations - Confusing paragraph about logical results removed (and it is redundant with other paragraphs) --- jsonschema-core.xml | 20 ++++++++++++-------- jsonschema-validation.xml | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 8552bc85..e35f7a69 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2085,7 +2085,8 @@ "items", whose behavior is defined in terms of "prefixItems" - "contains", whose behavior is defined in terms of "minContains" + "contains", whose behavior is affected by the presence and value of + "minContains", in the Validation vocabulary @@ -2338,15 +2339,18 @@ An array instance is valid against "contains" if at least one of - its elements is valid against the given schema. The subschema MUST be - applied to every array element even after the first match has - been found, in order to collect annotations for use by other keywords. - This is to ensure that all possible annotations are collected. + its elements is valid against the given schema, provided that + "minContains" is not present or is a value greater than 0. - Logically, the validation result of applying the value subschema to each - item in the array MUST be ORed with "false", resulting in an overall - validation result. + If "minContains" is present and has a value of 0, then an array instance + is valid against this keyword only if NONE of its elements is valid + against the given schema. + + + The subschema MUST be applied to every array element even after the first + match has been found, in order to collect annotations for use by other + keywords. This is to ensure that all possible annotations are collected. This keyword produces an annotation value which is an array of diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index beb22e4f..1278ffd5 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -213,6 +213,23 @@ . +
+ + Schema keywords typically operate independently, without + affecting each other's outcomes. + + + For schema author convenience, there are some exceptions among the + keywords in this vocabulary: + + + "maxContains" and "minContains", whose behavior is affected by the + presence and value of "contains", in the Applicator vocabulary + + + +
+
@@ -418,6 +435,12 @@ result is a boolean "true" and the instance array length is less than or equal to the "maxContains" value. + + If annotations are not being collected, the validation value may be determined + by considering the number of instance elements that are valid against the + "contains" schema: validation is successful if and only if the number of valid + elements is less than or equal to the "maxContains" value. +
@@ -437,10 +460,17 @@ annotation result is a boolean "true" and the instance array length is greater than or equal to the "minContains" value. + + If annotations are not being collected, the validation value may be determined + by considering the number of instance elements that are valid against the + "contains" schema: validation is successful if and only if the number of valid + elements is greater than or equal to the "minContains" value. + A value of 0 is allowed, but is only useful for setting a range - of occurrences from 0 to the value of "maxContains". A value of - 0 with no "maxContains" causes "contains" to always pass validation. + of occurrences from 0 to the value of "maxContains". A value of + 0 causes "contains" to always pass validation (but validation can still fail + against a "maxContains" keyword). Omitting this keyword has the same behavior as a value of 1. From f78b65ceb7326786749daa19614da23054fd6772 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 31 May 2021 16:25:40 -0700 Subject: [PATCH 4/5] "contains" did not annotate before 2020-12 --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index e35f7a69..80115467 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -3859,7 +3859,7 @@ https://example.com/schemas/common#/$defs/count/minimum "$schema" MAY change for embedded resources Array-value "items" functionality is now "prefixItems" "items" subsumes the old function of "additionalItems" - "contains" and "unevaluatedItems" interactions now specified + "contains" annotation behavior, and "contains" and "unevaluatedItems" interactions now specified Rename $recursive* to $dynamic* $dynamicAnchor defines a fragment like $anchor $dynamic* (previously $recursive) no longer use runtime base URI determination From dca53612ed5386f7014964191f3009d2c5706f2a Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 31 May 2021 16:26:03 -0700 Subject: [PATCH 5/5] $recursiveRef -> $dynamicRef was not just a simple keyword renaming --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 80115467..513f4659 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -3860,7 +3860,7 @@ https://example.com/schemas/common#/$defs/count/minimum Array-value "items" functionality is now "prefixItems" "items" subsumes the old function of "additionalItems" "contains" annotation behavior, and "contains" and "unevaluatedItems" interactions now specified - Rename $recursive* to $dynamic* + Rename $recursive* to $dynamic*, with behavior modification $dynamicAnchor defines a fragment like $anchor $dynamic* (previously $recursive) no longer use runtime base URI determination Define Compound Schema Documents (bundle) and processing