Skip to content

Commit c872253

Browse files
authored
Merge pull request #525 from handrews/minmaxcontains
Add minContains and maxContains
2 parents 333ee7f + ccf75dd commit c872253

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

jsonschema-validation.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
All of the keywords in the <xref target="general">general</xref>,
204204
<xref target="numeric">numeric</xref>, and <xref target="string">string</xref>
205205
sections are assertions, as well as "minItems", "maxItems", "uniqueItems",
206+
"minContains", "maxContains",
206207
"minProperties", "maxProperties", and "required". Additionally, "dependencies"
207208
is shorthand for a combination of conditional and assertion keywords.
208209
</t>
@@ -585,6 +586,44 @@
585586
its elements is valid against the given schema.
586587
</t>
587588
</section>
589+
590+
<section title="maxContains">
591+
<t>
592+
The value of this keyword MUST be a non-negative integer.
593+
</t>
594+
<t>
595+
An array instance is valid against "maxContains" if the number of
596+
elements that are valid against the schema for "contains" is
597+
less than, or equal to, the value of this keyword.
598+
</t>
599+
<t>
600+
If "contains" is not present within the same schema object,
601+
then this keyword has no effect.
602+
</t>
603+
</section>
604+
605+
<section title="minContains">
606+
<t>
607+
The value of this keyword MUST be a non-negative integer.
608+
</t>
609+
<t>
610+
An array instance is valid against "minContains" if the number of
611+
elements that are valid against the schema for "contains" is
612+
greater than, or equal to, the value of this keyword.
613+
</t>
614+
<t>
615+
A value of 0 is allowed, but is only useful for setting a range
616+
of occurrences from 0 to the value of "maxContains". A value of
617+
0 with no "maxContains" causes "contains" to always pass validation.
618+
</t>
619+
<t>
620+
If "contains" is not present within the same schema object,
621+
then this keyword has no effect.
622+
</t>
623+
<t>
624+
Omitting this keyword has the same behavior as a value of 1.
625+
</t>
626+
</section>
588627
</section>
589628

590629
<section title="Validation Keywords for Objects">

0 commit comments

Comments
 (0)