|
635 | 635 | </section>
|
636 | 636 | </section>
|
637 | 637 |
|
| 638 | + <section title="Keywords for applying subschemas conditionally"> |
| 639 | + <t> |
| 640 | + These keywords work together to implement conditional |
| 641 | + application of a subschema based on the outcome of |
| 642 | + another subschema. |
| 643 | + </t> |
| 644 | + <t> |
| 645 | + These keywords MUST NOT interact with each other across |
| 646 | + subschema boundaries. In other words, an "if" in one |
| 647 | + branch of an "allOf" MUST NOT have an impact on a "then" |
| 648 | + or "else" in another branch. |
| 649 | + </t> |
| 650 | + <section title="if"> |
| 651 | + <t> |
| 652 | + This keyword's value MUST be a valid JSON Schema. |
| 653 | + </t> |
| 654 | + <t> |
| 655 | + Instances that successfully validate against this |
| 656 | + keyword's subschema MUST also be valid against |
| 657 | + the subschema value of the "then" keyword, if |
| 658 | + present. |
| 659 | + </t> |
| 660 | + <t> |
| 661 | + Instances that fail to validate against this |
| 662 | + keyword's subschema MUST also be valid against |
| 663 | + the subschema value of the "else" keyword. |
| 664 | + </t> |
| 665 | + <t> |
| 666 | + Validation of the instance against this keyword |
| 667 | + on its own always succeeds, regardless of the |
| 668 | + validation outcome of against its subschema. |
| 669 | + </t> |
| 670 | + </section> |
| 671 | + <section title="then"> |
| 672 | + <t> |
| 673 | + This keyword's value MUST be a valid JSON Schema. |
| 674 | + </t> |
| 675 | + <t> |
| 676 | + When present alongside of "if", the instance |
| 677 | + successfully validates against this keyword if |
| 678 | + it validates against both the "if"'s subschema |
| 679 | + and this keyword's subschema. |
| 680 | + </t> |
| 681 | + <t> |
| 682 | + When "if" is absent, or the instance fails to |
| 683 | + validate against its subschema, validation against |
| 684 | + this keyword always succeeds. Implementations |
| 685 | + SHOULD avoid attempting to validate against |
| 686 | + the subschema in these cases. |
| 687 | + </t> |
| 688 | + </section> |
| 689 | + <section title="else"> |
| 690 | + <t> |
| 691 | + This keyword's value MUST be a valid JSON Schema. |
| 692 | + </t> |
| 693 | + <t> |
| 694 | + When present alongside of "if", the instance |
| 695 | + successfully validates against this keyword if |
| 696 | + it fails to validate against the "if"'s |
| 697 | + subschema, and successfully validates against |
| 698 | + this keyword's subschema. |
| 699 | + </t> |
| 700 | + <t> |
| 701 | + When "if" is absent, or the instance successfully |
| 702 | + validates against its subschema, validation against |
| 703 | + this keyword always succeeds. Implementations |
| 704 | + SHOULD avoid attempting to validate against |
| 705 | + the subschema in these cases. |
| 706 | + </t> |
| 707 | + </section> |
| 708 | + </section> |
| 709 | + |
638 | 710 | <section title="Keywords for applying subschemas with boolean logic">
|
639 | 711 | <section title="allOf">
|
640 | 712 | <t>
|
|
0 commit comments