|
223 | 223 | <t>
|
224 | 224 | Validation keywords in a schema impose requirements for successful validation of an
|
225 | 225 | instance. These keywords are all assertions without any annotation behavior.
|
226 |
| - <cref> |
227 |
| - "dependencies" has applicator behavior, but this keyword will be split |
228 |
| - into separate assertion and applicator keywords before the next draft publication. |
229 |
| - </cref> |
230 | 226 | </t>
|
231 | 227 |
|
232 | 228 | <section title="Validation Keywords for Any Instance Type" anchor="general">
|
|
454 | 450 | </t>
|
455 | 451 | </section>
|
456 | 452 |
|
457 |
| - <section title="dependencies"> |
| 453 | + <section title="requiredDependencies"> |
458 | 454 | <t>
|
459 |
| - <cref> |
460 |
| - This keyword may be split into two, with the variation that uses |
461 |
| - an array of property names rather than a subschema getting a new |
462 |
| - name. The dual behavior is confusing and relatively difficult to |
463 |
| - implement. In the previous draft, we proposed dropping the keyword |
464 |
| - altogether, or dropping one of its forms, but we received feedback |
465 |
| - in support of keeping it. See issues #442 and #528 at |
466 |
| - <https://github.com/json-schema-org/json-schema-spec/issues> |
467 |
| - for further discussion. Further feedback is encouraged. |
468 |
| - </cref> |
| 455 | + This keyword specifies property requirements that are conditional |
| 456 | + based on the presence of other properties. |
469 | 457 | </t>
|
470 | 458 | <t>
|
471 |
| - This keyword specifies rules that are evaluated if the instance is an object and |
472 |
| - contains a certain property. |
473 |
| - </t> |
474 |
| - <t> |
475 |
| - This keyword's value MUST be an object. Each property specifies a dependency. |
476 |
| - Each dependency value MUST be an array or a valid JSON Schema. |
477 |
| - </t> |
478 |
| - <t> |
479 |
| - If the dependency value is a subschema, and the dependency key is a property |
480 |
| - in the instance, the entire instance must validate against the dependency value. |
481 |
| - </t> |
482 |
| - <t> |
483 |
| - If the dependency value is an array, each element in the array, |
484 |
| - if any, MUST be a string, and MUST be unique. If the dependency key is |
485 |
| - a property in the instance, each of the items in the dependency |
486 |
| - value must be a property that exists in the instance. |
| 459 | + This keyword's value MUST be an object. Each property specifies |
| 460 | + a dependent requirement, which MUST be an array. Each element |
| 461 | + in the array, if any, MUST be a string, and MUST be unique. |
| 462 | + If the dependency key is a property in the instance, each of the items |
| 463 | + in the dependency value MUST be a property that exists in the instance. |
487 | 464 | </t>
|
488 | 465 | <t>
|
489 | 466 | Omitting this keyword has the same behavior as an empty object.
|
|
1067 | 1044 | as a generic mechanism on which validation, hyper-schema, and extension
|
1068 | 1045 | vocabularies can all be based
|
1069 | 1046 | </t>
|
| 1047 | + <t hangText='"dependencies"'> |
| 1048 | + This keyword had two different modes of behavior, which made it |
| 1049 | + relatively challenging to implement and reason about. |
| 1050 | + The schema form has been moved to Core under the original |
| 1051 | + "dependencies" keyword, as part of the applicator vocabulary. |
| 1052 | + It is analogous to "properties", except that instead of applying |
| 1053 | + its subschema to the property value, it applies it to the object |
| 1054 | + containing the property. |
| 1055 | + The property name array form is retained here and renamed to |
| 1056 | + "requiredDependencies", as it is an assertion which is a shortcut |
| 1057 | + for the conditional use of the "required" assertion keyword. |
| 1058 | + </t> |
1070 | 1059 | </list>
|
1071 | 1060 | </t>
|
1072 | 1061 | </section>
|
|
1106 | 1095 | <list style="symbols">
|
1107 | 1096 | <t>Moved "definitions" to the core spec as "$defs"</t>
|
1108 | 1097 | <t>Moved applicator keywords to the core spec</t>
|
| 1098 | + <t>Renamed the array form of "dependencies" to "requiredDependencies", moved the schema form to the core spec</t> |
1109 | 1099 | </list>
|
1110 | 1100 | </t>
|
1111 | 1101 | <t hangText="draft-handrews-json-schema-validation-01">
|
|
0 commit comments