|
719 | 719 | <xref target="schema-document">schema object</xref>.
|
720 | 720 | </t>
|
721 | 721 | </section>
|
722 |
| - <section title="Default Behaviors"> |
| 722 | + <section title="Default Behaviors" anchor="default-behaviors"> |
723 | 723 | <t>
|
724 | 724 | A missing keyword MUST NOT produce a false assertion result, MUST
|
725 | 725 | NOT produce annotation results, and MUST NOT cause any other schema
|
|
2522 | 2522 | The value of this keyword MUST be a non-negative integer.
|
2523 | 2523 | </t>
|
2524 | 2524 | <t>
|
2525 |
| - If "contains" is not present within the same schema object, |
2526 |
| - then this keyword has no effect. |
| 2525 | + This keyword modifies the behavior of "contains" within the same schema object, |
| 2526 | + as described below in the section for that keyword. |
2527 | 2527 | </t>
|
2528 | 2528 | <t>
|
2529 |
| - An instance array or object is valid against "maxContains" in two ways, |
2530 |
| - depending on the form of the annotation result of an adjacent |
2531 |
| - "contains" keyword. The first way is if |
2532 |
| - the annotation result is an array and the length of that array is less than |
2533 |
| - or equal to the "maxContains" value. The second way is if the annotation |
2534 |
| - result is a boolean "true" and the instance length (number of items or |
2535 |
| - properties) is less than or equal to the "maxContains" value. |
| 2529 | + Validation MUST always succeed against this keyword. |
| 2530 | + The value of this keyword is used as its annotation result. |
2536 | 2531 | </t>
|
2537 | 2532 | </section>
|
2538 | 2533 |
|
|
2541 | 2536 | The value of this keyword MUST be a non-negative integer.
|
2542 | 2537 | </t>
|
2543 | 2538 | <t>
|
2544 |
| - If "contains" is not present within the same schema object, |
2545 |
| - then this keyword has no effect. |
| 2539 | + This keyword modifies the behavior of "contains" within the same schema object, |
| 2540 | + as described below in the section for that keyword. |
2546 | 2541 | </t>
|
2547 | 2542 | <t>
|
2548 |
| - An instance array or object is valid against "minContains" in two ways, |
2549 |
| - depending on the form of the annotation result of an adjacent |
2550 |
| - "contains" keyword. The first way is if |
2551 |
| - the annotation result is an array and the length of that array is greater |
2552 |
| - than or equal to the "minContains" value. The second way is if the |
2553 |
| - annotation result is a boolean "true" and the instance length (number of |
2554 |
| - items or properties) is greater than or equal to the "minContains" value. |
| 2543 | + Validation MUST always succeed against this keyword. |
| 2544 | + The value of this keyword is used as its annotation result. |
2555 | 2545 | </t>
|
2556 |
| - <t> |
2557 |
| - A value of 0 is allowed, but is only useful for setting a range |
2558 |
| - of occurrences from 0 to the value of "maxContains". A value of |
2559 |
| - 0 causes "minContains" and "contains" to always pass validation |
2560 |
| - (but validation can still fail against a "maxContains" keyword). |
2561 |
| - </t> |
2562 |
| - <t> |
2563 |
| - Omitting this keyword has the same behavior as a value of 1. |
| 2546 | + <t> Per section <xref target="default-behaviors" format="counter"></xref>, |
| 2547 | + omitted keywords MUST NOT produce annotation results. However, as described |
| 2548 | + in the section for "contains", the absence of this keyword's annotation |
| 2549 | + causes "contains" to assume a minimum value of 1. |
2564 | 2550 | </t>
|
2565 | 2551 | </section>
|
2566 | 2552 |
|
|
2569 | 2555 | The value of this keyword MUST be a valid JSON Schema.
|
2570 | 2556 | </t>
|
2571 | 2557 | <t>
|
2572 |
| - An array instance is valid against "contains" if at least one of |
2573 |
| - its elements is valid against the given schema, |
2574 |
| - except when "minContains" is present and has a value of 0, in which |
2575 |
| - case an array instance MUST be considered valid against the "contains" keyword, |
2576 |
| - even if none of its elements is valid against the given schema. |
| 2558 | + This keyword applies its subschema to array elements or object property values. |
| 2559 | + </t> |
| 2560 | + <t> |
| 2561 | + An instance is valid against "contains" if the number of elements or property |
| 2562 | + values that are valid against its subschema is with the inclusive range of |
| 2563 | + the minimum and (if any) maximum number of occurrences. |
2577 | 2564 | </t>
|
2578 | 2565 | <t>
|
2579 |
| - An object instance is valid against "contains" if at least one of |
2580 |
| - its properties is valid against the given schema, |
2581 |
| - except when "minContains" is present and has a value of 0, in which |
2582 |
| - case an object instance MUST be considered valid against the "contains" keyword, |
2583 |
| - even if none of its property values is valid against the given schema. |
| 2566 | + The maximum number of occurrences is provided by the "maxContains" keyword |
| 2567 | + within the same schema object as "contains". If "maxContains" is absent, |
| 2568 | + the maximum number of occurrences MUST be unbounded. |
| 2569 | + </t> |
| 2570 | + <t> |
| 2571 | + The minimum number of occurrences is provided by the "minContains" keyword |
| 2572 | + within the same schema object as "contains". If "minContains" is absent, |
| 2573 | + the minimum number of occurrences MUST be 1. |
| 2574 | + </t> |
| 2575 | + <t> |
| 2576 | + Implementations MAY implement the dependency on "minContians" and |
| 2577 | + "maxContains" by inspecting their values rather than reading annotations |
| 2578 | + produced by those keywords. |
2584 | 2579 | </t>
|
2585 | 2580 | <t>
|
2586 | 2581 | This keyword produces an annotation value which is an array of the
|
|
2593 | 2588 | </t>
|
2594 | 2589 | <t>
|
2595 | 2590 | This annotation affects the behavior of "unevaluatedItems" in the
|
2596 |
| - Unevaluated vocabulary, and MAY also be used to implement the |
2597 |
| - "minContains" and "maxContains" keywords in the Validation vocabulary. |
| 2591 | + Unevaluated vocabulary. |
2598 | 2592 | </t>
|
2599 | 2593 | <t>
|
2600 |
| - The subschema MUST be applied to every array element even after the first |
2601 |
| - match has been found, in order to collect annotations for use by other |
2602 |
| - keywords. This is to ensure that all possible annotations are collected. |
| 2594 | + The subschema MUST be applied to every array element or object property |
| 2595 | + value even after the first match has been found, in order to collect |
| 2596 | + annotations for use by other keywords. This is to ensure that all possible |
| 2597 | + annotations are collected. |
2603 | 2598 | </t>
|
2604 | 2599 | </section>
|
2605 | 2600 | </section>
|
|
0 commit comments