Skip to content

Commit b85275c

Browse files
rewording of sections on "contains", "maxContains", "minContains"
- More cross-references added that note the dependence of these keywords on each other - Confusing paragraph about logical results removed (and it is redundant with other paragraphs)
1 parent b47fed9 commit b85275c

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

jsonschema-core.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,8 @@
20852085
"items", whose behavior is defined in terms of "prefixItems"
20862086
</t>
20872087
<t>
2088-
"contains", whose behavior is defined in terms of "minContains"
2088+
"contains", whose behavior is affected by the presence and value of
2089+
"minContains", in the Validation vocabulary
20892090
</t>
20902091
</list>
20912092
</t>
@@ -2339,15 +2340,10 @@
23392340
</t>
23402341
<t>
23412342
An array instance is valid against "contains" if at least one of
2342-
its elements is valid against the given schema. The subschema MUST be
2343-
applied to every array element even after the first match has
2344-
been found, in order to collect annotations for use by other keywords.
2345-
This is to ensure that all possible annotations are collected.
2346-
</t>
2347-
<t>
2348-
Logically, the validation result of applying the value subschema to each
2349-
item in the array MUST be ORed with "false", resulting in an overall
2350-
validation result.
2343+
its elements is valid against the given schema,
2344+
except when "minContains" is present and has a value of 0, in which
2345+
case an array instance MUST be valid against the "contains" keyword,
2346+
even if NONE of its elements is valid against the given schema.
23512347
</t>
23522348
<t>
23532349
This keyword produces an annotation value which is an array of
@@ -2356,8 +2352,16 @@
23562352
the subschema validates successfully when applied to every index of the
23572353
instance. The annotation MUST be present if the instance array to which
23582354
this keyword's schema applies is empty.
2355+
</t>
2356+
<t>
23592357
This annotation affects the behavior of "unevaluatedItems" in the
2360-
Unevaluated vocabulary.
2358+
Unevaluated vocabulary, and MAY also be used to implement the
2359+
"minContains" and "maxContains" keywords in the Validation vocabulary.
2360+
</t>
2361+
<t>
2362+
The subschema MUST be applied to every array element even after the first
2363+
match has been found, in order to collect annotations for use by other
2364+
keywords. This is to ensure that all possible annotations are collected.
23612365
</t>
23622366
</section>
23632367
</section>

jsonschema-validation.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,9 @@
442442
</t>
443443
<t>
444444
A value of 0 is allowed, but is only useful for setting a range
445-
of occurrences from 0 to the value of "maxContains". A value of
446-
0 with no "maxContains" causes "contains" to always pass validation.
445+
of occurrences from 0 to the value of "maxContains". A value of
446+
0 causes "minContains" to always pass validation (but validation can
447+
still fail against a "maxContains" keyword).
447448
</t>
448449
<t>
449450
Omitting this keyword has the same behavior as a value of 1.

0 commit comments

Comments
 (0)