Skip to content

Commit 1b620aa

Browse files
committed
addressing annotation requirements in contains
1 parent f1422a0 commit 1b620aa

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

jsonschema-core.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ keyword's annotation causes `contains` to assume a minimum value of 1.
17741774

17751775
The value of this keyword MUST be a valid JSON Schema.
17761776

1777-
This keyword applies its subschema to array elements.
1777+
This keyword applies to array instances by applying its subschema to the array's elements.
17781778

17791779
An instance is valid against `contains` if the number of elements that are valid
17801780
against its subschema is with the inclusive range of the minimum and (if any)
@@ -1788,22 +1788,24 @@ The minimum number of occurrences is provided by the `minContains` keyword
17881788
within the same schema object as `contains`. If `minContains` is absent, the
17891789
minimum number of occurrences MUST be 1.
17901790

1791-
Implementations MAY implement the dependency on `minContains` and `maxContains`
1792-
by inspecting their values rather than reading annotations produced by those
1793-
keywords.
1794-
1795-
This keyword produces an annotation value which is an array of the indexes to
1791+
This keyword produces an annotation value which is an array of the indices for
17961792
which this keyword validates successfully when applying its subschema, in
17971793
ascending order. The value MAY be a boolean `true` if the subschema validates
17981794
successfully when applied to every index of the instance. The annotation MUST be
17991795
present if the instance array to which this keyword's schema applies
18001796
is empty.
18011797

1802-
This annotation affects the behavior of `unevaluatedItems`.
1798+
The presence of this keyword affects the behavior of
1799+
[`unevaluatedItems`](#unevaluateditems).
1800+
1801+
Under most circumstances, the `contains` subschema MAY be short-circuited.
1802+
However, for the following cases, the `contains` subschema MUST be applied to
1803+
every array element.
18031804

1804-
The subschema MUST be applied to every array element even after the first match
1805-
has been found, in order to collect annotations for use by other keywords. This
1806-
is to ensure that all possible annotations are collected.
1805+
- If `unevaluatedItems` appears in any subschema in the dynamic scope that
1806+
applies to the same instance location, to ensure that all evaluated items are
1807+
accounted for.
1808+
- When collecting annotations, to ensure that all annotations are found.
18071809

18081810
## Keywords for Unevaluated Locations
18091811

@@ -1821,16 +1823,15 @@ If an item in an array or an object property is "successfully evaluated", it is
18211823
logically considered to be valid in terms of the representation of the object or
18221824
array that's expected. For example if a subschema represents a car, which
18231825
requires between 2-4 wheels, and the value of "wheels" is 6, the instance object
1824-
is not "evaluated" to be a car, and the "wheels" property is considered
1825-
"unevaluated (successfully as a known thing)", and does not retain any
1826-
annotations.
1826+
is not "evaluated" to be a car, and thus the "wheels" property is considered
1827+
"unevaluated".
18271828

18281829
Recall that adjacent keywords are keywords within the same schema object, and
18291830
that the dynamic-scope subschemas include reference targets as well as lexical
18301831
subschemas.
18311832

1832-
The behavior of these keywords depend on the annotation results of adjacent
1833-
keywords that apply to the instance location being validated.
1833+
The behaviors of these keywords depend on adjacent keywords as well as any
1834+
keywords in subschemas that apply to the instance location being evaluated.
18341835

18351836
### Keyword Independence
18361837

0 commit comments

Comments
 (0)