From 80441f7f338202904cba08f50d5d8f9e26cd535e Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 27 Sep 2023 21:05:43 +1300 Subject: [PATCH 1/5] remove object instances as target for `contains` --- jsonschema-core.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/jsonschema-core.md b/jsonschema-core.md index 4ac66543..3f5c0275 100644 --- a/jsonschema-core.md +++ b/jsonschema-core.md @@ -1956,11 +1956,11 @@ keyword's annotation causes `contains` to assume a minimum value of 1. The value of this keyword MUST be a valid JSON Schema. -This keyword applies its subschema to array elements or object property values. +This keyword applies its subschema to array elements. -An instance is valid against `contains` if the number of elements or property -values that are valid against its subschema is with the inclusive range of the -minimum and (if any) maximum number of occurrences. +An instance is valid against `contains` if the number of elements that are valid +against its subschema is with the inclusive range of the minimum and (if any) +maximum number of occurrences. The maximum number of occurrences is provided by the `maxContains` keyword within the same schema object as `contains`. If `maxContains` is absent, the @@ -1970,24 +1970,23 @@ The minimum number of occurrences is provided by the `minContains` keyword within the same schema object as `contains`. If `minContains` is absent, the minimum number of occurrences MUST be 1. -Implementations MAY implement the dependency on `minContians` and `maxContains` +Implementations MAY implement the dependency on `minContains` and `maxContains` by inspecting their values rather than reading annotations produced by those keywords. -This keyword produces an annotation value which is an array of the indexes or -property names to which this keyword validates successfully when applying its -subschema, in ascending order. The value MAY be a boolean `true` if the -subschema validates successfully when applied to every index or property value -of the instance. The annotation MUST be present if the instance array or object -to which this keyword's schema applies is empty. +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 validates +successfully when applied to every index of the instance. The annotation MUST be +present if the instance array or object to which this keyword's schema applies +is empty. This annotation affects the behavior of `unevaluatedItems` in the Unevaluated vocabulary. -The subschema MUST be applied to every array element or object property value -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. +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. ## A Vocabulary for Unevaluated Locations From dca9146bb876409499114ab8cf177c3b465a5a36 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 27 Sep 2023 21:10:41 +1300 Subject: [PATCH 2/5] remove `contains` from `unevaluated*` --- jsonschema-core.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/jsonschema-core.md b/jsonschema-core.md index 3f5c0275..9b0be69b 100644 --- a/jsonschema-core.md +++ b/jsonschema-core.md @@ -2072,25 +2072,25 @@ The value of `unevaluatedProperties` MUST be a valid JSON Schema. The behavior of this keyword depends on the annotation results of adjacent keywords that apply to the instance location being validated. Specifically, the -annotations from `properties`, `patternProperties`, `contains`, and -`additionalProperties`, which can come from those keywords when they are -adjacent to the `unevaluatedProperties` keyword. Those four annotations, as well -as `unevaluatedProperties`, can also result from any and all adjacent [in-place +annotations from `properties`, `patternProperties`, and `additionalProperties`, +which can come from those keywords when they are adjacent to the +`unevaluatedProperties` keyword. Those four annotations, as well as +`unevaluatedProperties`, can also result from any and all adjacent [in-place applicator](#in-place) keywords. This includes but is not limited to the in-place applicators defined in this document. Validation with `unevaluatedProperties` applies only to the child values of instance names that do not appear in the `properties`, `patternProperties`, -`additionalProperties`, `contains`, or `unevaluatedProperties` annotation -results that apply to the instance location being validated. +`additionalProperties`, or `unevaluatedProperties` annotation results that apply +to the instance location being validated. For all such properties, validation succeeds if the child instance validates against the `unevaluatedProperties` schema. -This means that `properties`, `patternProperties`, `additionalProperties`, -`contains` and all in-place applicators MUST be evaluated before this keyword -can be evaluated. Authors of extension keywords MUST NOT define an in-place -applicator that would need to be evaluated after this keyword. +This means that `properties`, `patternProperties`, `additionalProperties`, and +all in-place applicators MUST be evaluated before this keyword can be evaluated. +Authors of extension keywords MUST NOT define an in-place applicator that would +need to be evaluated after this keyword. 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 From e39d5ba185c14f84192f6d2c1d1bd8b36f2c3d55 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 27 Sep 2023 21:11:46 +1300 Subject: [PATCH 3/5] remove '`contains` now applies to objects' release note --- jsonschema-core.md | 1 - 1 file changed, 1 deletion(-) diff --git a/jsonschema-core.md b/jsonschema-core.md index 9b0be69b..ddf6c7d4 100644 --- a/jsonschema-core.md +++ b/jsonschema-core.md @@ -3314,7 +3314,6 @@ to the document. [^19]: This section to be removed before leaving Internet-Draft status. ### draft-bhutton-json-schema-next -- `contains` now applies to objects as well as arrays - Use IRIs instead of URIs, including allowing unicode in plain-name fragments - Clarify that detecting duplicate IRIs for different schemas SHOULD raise an error - Consolidate and clarify the syntax and rationale for plain-name fragments From f9fdd133a6e847116cec9d8b3dde0a826a122e3f Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 27 Sep 2023 21:12:50 +1300 Subject: [PATCH 4/5] `contains` cleanup --- jsonschema-core.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jsonschema-core.md b/jsonschema-core.md index ddf6c7d4..741181e2 100644 --- a/jsonschema-core.md +++ b/jsonschema-core.md @@ -2032,8 +2032,7 @@ 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`, `contains`, - and itself + from `properties`, `patternProperties`, `additionalProperties`, and itself ### `unevaluatedItems` {#unevaluateditems} From ce43fa973e50245ed75b0f6af8c7032f4f95be29 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Tue, 3 Oct 2023 12:06:39 +1300 Subject: [PATCH 5/5] found another "object" Co-authored-by: Jason Desrosiers --- jsonschema-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.md b/jsonschema-core.md index 741181e2..57295edb 100644 --- a/jsonschema-core.md +++ b/jsonschema-core.md @@ -1978,7 +1978,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 subschema validates successfully when applied to every index of the instance. The annotation MUST be -present if the instance array or object to which this keyword's schema applies +present if the instance array to which this keyword's schema applies is empty. This annotation affects the behavior of `unevaluatedItems` in the Unevaluated