Skip to content

Commit 15b617f

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 ab94dd8 commit 15b617f

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

jsonschema-core.xml

Lines changed: 12 additions & 8 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>
@@ -2338,15 +2339,18 @@
23382339
</t>
23392340
<t>
23402341
An array instance is valid against "contains" if at least one of
2341-
its elements is valid against the given schema. The subschema MUST be
2342-
applied to every array element even after the first match has
2343-
been found, in order to collect annotations for use by other keywords.
2344-
This is to ensure that all possible annotations are collected.
2342+
its elements is valid against the given schema, provided that
2343+
"minContains" is not present or is a value greater than 0.
23452344
</t>
23462345
<t>
2347-
Logically, the validation result of applying the value subschema to each
2348-
item in the array MUST be ORed with "false", resulting in an overall
2349-
validation result.
2346+
If "minContains" is present and has a value of 0, then an array instance
2347+
is valid against this keyword only if NONE of its elements is valid
2348+
against the given schema.
2349+
</t>
2350+
<t>
2351+
The subschema MUST be applied to every array element even after the first
2352+
match has been found, in order to collect annotations for use by other
2353+
keywords. This is to ensure that all possible annotations are collected.
23502354
</t>
23512355
<t>
23522356
This keyword produces an annotation value which is an array of

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 "contains" to always pass validation (but validation can still fail
447+
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)