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