|
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> |
469 |
| - </t> |
470 |
| - <t> |
471 |
| - This keyword specifies rules that are evaluated if the instance is an object and |
472 |
| - contains a certain property. |
| 455 | + The value of this keyword MUST be an object. Properties in |
| 456 | + this object, if any, MUST be arrays. Elements in each array, |
| 457 | + if any, MUST be strings, and MUST be unique. |
473 | 458 | </t>
|
474 | 459 | <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. |
| 460 | + This keyword specifies properties that are required if a specific |
| 461 | + other property is present. |
477 | 462 | </t>
|
478 | 463 | <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. |
| 464 | + Validation succeeds if, for each name that appears in both |
| 465 | + the instance and as a name within this keyword's value, every |
| 466 | + item in the corresponding array is also the name of a property |
| 467 | + in the instance. |
487 | 468 | </t>
|
488 | 469 | <t>
|
489 | 470 | Omitting this keyword has the same behavior as an empty object.
|
|
1067 | 1048 | as a generic mechanism on which validation, hyper-schema, and extension
|
1068 | 1049 | vocabularies can all be based
|
1069 | 1050 | </t>
|
| 1051 | + <t hangText='"dependencies"'> |
| 1052 | + This keyword had two different modes of behavior, which made it |
| 1053 | + relatively challenging to implement and reason about. |
| 1054 | + The schema form has been moved to Core under the original |
| 1055 | + "dependencies" keyword, as part of the applicator vocabulary. |
| 1056 | + It is analogous to "properties", except that instead of applying |
| 1057 | + its subschema to the property value, it applies it to the object |
| 1058 | + containing the property. |
| 1059 | + The property name array form is retained here and renamed to |
| 1060 | + "requiredDependencies", as it is an assertion which is a shortcut |
| 1061 | + for the conditional use of the "required" assertion keyword. |
| 1062 | + </t> |
1070 | 1063 | </list>
|
1071 | 1064 | </t>
|
1072 | 1065 | </section>
|
|
1106 | 1099 | <list style="symbols">
|
1107 | 1100 | <t>Moved "definitions" to the core spec as "$defs"</t>
|
1108 | 1101 | <t>Moved applicator keywords to the core spec</t>
|
| 1102 | + <t>Renamed the array form of "dependencies" to "requiredDependencies", moved the schema form to the core spec</t> |
1109 | 1103 | </list>
|
1110 | 1104 | </t>
|
1111 | 1105 | <t hangText="draft-handrews-json-schema-validation-01">
|
|
0 commit comments