Skip to content

Commit 2cb7c74

Browse files
authoredNov 13, 2023
Merge pull request #1452 from json-schema-org/gregsdennis/revert-object-contains
Revert "`contains` applies to objects"
2 parents 822a7a6 + ce43fa9 commit 2cb7c74

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed
 

‎jsonschema-core.md

+25-28
Original file line numberDiff line numberDiff line change
@@ -1986,11 +1986,11 @@ keyword's annotation causes `contains` to assume a minimum value of 1.
19861986

19871987
The value of this keyword MUST be a valid JSON Schema.
19881988

1989-
This keyword applies its subschema to array elements or object property values.
1989+
This keyword applies its subschema to array elements.
19901990

1991-
An instance is valid against `contains` if the number of elements or property
1992-
values that are valid against its subschema is with the inclusive range of the
1993-
minimum and (if any) maximum number of occurrences.
1991+
An instance is valid against `contains` if the number of elements that are valid
1992+
against its subschema is with the inclusive range of the minimum and (if any)
1993+
maximum number of occurrences.
19941994

19951995
The maximum number of occurrences is provided by the `maxContains` keyword
19961996
within the same schema object as `contains`. If `maxContains` is absent, the
@@ -2000,24 +2000,23 @@ The minimum number of occurrences is provided by the `minContains` keyword
20002000
within the same schema object as `contains`. If `minContains` is absent, the
20012001
minimum number of occurrences MUST be 1.
20022002

2003-
Implementations MAY implement the dependency on `minContians` and `maxContains`
2003+
Implementations MAY implement the dependency on `minContains` and `maxContains`
20042004
by inspecting their values rather than reading annotations produced by those
20052005
keywords.
20062006

2007-
This keyword produces an annotation value which is an array of the indexes or
2008-
property names to which this keyword validates successfully when applying its
2009-
subschema, in ascending order. The value MAY be a boolean `true` if the
2010-
subschema validates successfully when applied to every index or property value
2011-
of the instance. The annotation MUST be present if the instance array or object
2012-
to which this keyword's schema applies is empty.
2007+
This keyword produces an annotation value which is an array of the indexes to
2008+
which this keyword validates successfully when applying its subschema, in
2009+
ascending order. The value MAY be a boolean `true` if the subschema validates
2010+
successfully when applied to every index of the instance. The annotation MUST be
2011+
present if the instance array to which this keyword's schema applies
2012+
is empty.
20132013

20142014
This annotation affects the behavior of `unevaluatedItems` in the Unevaluated
20152015
vocabulary.
20162016

2017-
The subschema MUST be applied to every array element or object property value
2018-
even after the first match has been found, in order to collect annotations for
2019-
use by other keywords. This is to ensure that all possible annotations are
2020-
collected.
2017+
The subschema MUST be applied to every array element even after the first match
2018+
has been found, in order to collect annotations for use by other keywords. This
2019+
is to ensure that all possible annotations are collected.
20212020

20222021
## A Vocabulary for Unevaluated Locations
20232022

@@ -2063,8 +2062,7 @@ outcomes. However, the keywords in this vocabulary are notable exceptions:
20632062
- `unevaluatedItems`, whose behavior is defined in terms of annotations from
20642063
`prefixItems`, `items`, `contains`, and itself
20652064
- `unevaluatedProperties`, whose behavior is defined in terms of annotations
2066-
from `properties`, `patternProperties`, `additionalProperties`, `contains`,
2067-
and itself
2065+
from `properties`, `patternProperties`, `additionalProperties`, and itself
20682066

20692067
### `unevaluatedItems` {#unevaluateditems}
20702068

@@ -2103,25 +2101,25 @@ The value of `unevaluatedProperties` MUST be a valid JSON Schema.
21032101

21042102
The behavior of this keyword depends on the annotation results of adjacent
21052103
keywords that apply to the instance location being validated. Specifically, the
2106-
annotations from `properties`, `patternProperties`, `contains`, and
2107-
`additionalProperties`, which can come from those keywords when they are
2108-
adjacent to the `unevaluatedProperties` keyword. Those four annotations, as well
2109-
as `unevaluatedProperties`, can also result from any and all adjacent [in-place
2104+
annotations from `properties`, `patternProperties`, and `additionalProperties`,
2105+
which can come from those keywords when they are adjacent to the
2106+
`unevaluatedProperties` keyword. Those four annotations, as well as
2107+
`unevaluatedProperties`, can also result from any and all adjacent [in-place
21102108
applicator](#in-place) keywords. This includes but is not limited to the
21112109
in-place applicators defined in this document.
21122110

21132111
Validation with `unevaluatedProperties` applies only to the child values of
21142112
instance names that do not appear in the `properties`, `patternProperties`,
2115-
`additionalProperties`, `contains`, or `unevaluatedProperties` annotation
2116-
results that apply to the instance location being validated.
2113+
`additionalProperties`, or `unevaluatedProperties` annotation results that apply
2114+
to the instance location being validated.
21172115

21182116
For all such properties, validation succeeds if the child instance validates
21192117
against the `unevaluatedProperties` schema.
21202118

2121-
This means that `properties`, `patternProperties`, `additionalProperties`,
2122-
`contains` and all in-place applicators MUST be evaluated before this keyword
2123-
can be evaluated. Authors of extension keywords MUST NOT define an in-place
2124-
applicator that would need to be evaluated after this keyword.
2119+
This means that `properties`, `patternProperties`, `additionalProperties`, and
2120+
all in-place applicators MUST be evaluated before this keyword can be evaluated.
2121+
Authors of extension keywords MUST NOT define an in-place applicator that would
2122+
need to be evaluated after this keyword.
21252123

21262124
The annotation result of this keyword is the set of instance property names
21272125
validated by this keyword's subschema. This annotation affects the behavior of
@@ -2824,7 +2822,6 @@ to the document.
28242822
[^19]: This section to be removed before leaving Internet-Draft status.
28252823

28262824
### draft-bhutton-json-schema-next
2827-
- `contains` now applies to objects as well as arrays
28282825
- Use IRIs instead of URIs, including allowing unicode in plain-name fragments
28292826
- Clarify that detecting duplicate IRIs for different schemas SHOULD raise an error
28302827
- Consolidate and clarify the syntax and rationale for plain-name fragments

0 commit comments

Comments
 (0)
Please sign in to comment.