From 110c24cd48b3174b87ac3df81775881956e3825e Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 1 Dec 2020 11:01:10 +0000 Subject: [PATCH 1/3] Clarify contains when applying to an empty array, annotation results, and how they are used --- jsonschema-core.xml | 15 +++++++++++---- jsonschema-validation.xml | 32 ++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index b6b79553..451c5a22 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2360,16 +2360,23 @@ An array instance is valid against "contains" if at least one of - its elements is valid against the given schema. Note that when - collecting annotations, the subschema MUST be applied to every - array element even after the first match has been found. This - is to ensure that all possible annotations are collected. + 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. + + + 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. This keyword produces an annotation value which is an array of the indexes to which this keyword validates successfully when applying its subschema, in ascending order. The value MAY be a boolean true if the subschema validated successfully when applied to every index of the instance. + If the instance array this keywords subschema is applicable to is empty, + the annotation value MUST NOT be missing. diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 1f13b611..8e1f3cf2 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -408,16 +408,18 @@ The value of this keyword MUST be a non-negative integer. - - An array instance is valid against "maxContains" if the number of - elements that are valid against the schema for - "contains" is - less than, or equal to, the value of this keyword. - If "contains" is not present within the same schema object, then this keyword has no effect. + + An array instance is valid against "maxContains" if its + value is less than or equal to, the array length of the annotation + result from an ajacent + "contains" keyword where the + annotation is an array, or the length of the instance array + where the annotation is "true". +
@@ -425,20 +427,22 @@ The value of this keyword MUST be a non-negative integer. - An array instance is valid against "minContains" if the number of - elements that are valid against the schema for - "contains" is - greater than, or equal to, the value of this keyword. + If "contains" is not present within the same schema object, + then this keyword has no effect. + + + An array instance is valid against "minContains" if its + value is greater than or equal to, the array length of the annotation + result from an ajacent + "contains" keyword where the + annotation is an array, or the length of the instance array + where the annotation is "true". 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. - - If "contains" is not present within the same schema object, - then this keyword has no effect. - Omitting this keyword has the same behavior as a value of 1. From 62c7eafd50dcc9485cb1fbfc488d0edd3edb6352 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 1 Dec 2020 11:03:10 +0000 Subject: [PATCH 2/3] Quotes around value --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 451c5a22..8e56bc88 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2373,7 +2373,7 @@ This keyword produces an annotation value which is an array of the indexes to which this keyword validates successfully when applying - its subschema, in ascending order. The value MAY be a boolean true if the + its subschema, in ascending order. The value MAY be a boolean "true" if the subschema validated successfully when applied to every index of the instance. If the instance array this keywords subschema is applicable to is empty, the annotation value MUST NOT be missing. From 3cf7cb8ef83713352686a5b80f2ec9fcb16b0467 Mon Sep 17 00:00:00 2001 From: Ben Hutton Date: Tue, 1 Dec 2020 11:05:34 +0000 Subject: [PATCH 3/3] Nothing to see here (fix spelling) --- jsonschema-validation.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 8e1f3cf2..797986df 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -415,7 +415,7 @@ An array instance is valid against "maxContains" if its value is less than or equal to, the array length of the annotation - result from an ajacent + result from an adjacent "contains" keyword where the annotation is an array, or the length of the instance array where the annotation is "true". @@ -433,7 +433,7 @@ An array instance is valid against "minContains" if its value is greater than or equal to, the array length of the annotation - result from an ajacent + result from an adjacent "contains" keyword where the annotation is an array, or the length of the instance array where the annotation is "true".