|
| 1 | +# JSON Schema Proposal: `propertyDependencies` Keyword |
| 2 | + |
| 3 | +## Abstract |
| 4 | + |
| 5 | +This document proposes a change to the JSON Schema Core specification and |
| 6 | +Applicator vocabulary by adding the `propertyDependencies` keyword. |
| 7 | + |
| 8 | +## Note to Readers |
| 9 | + |
| 10 | +The issues list for this proposal can be found at |
| 11 | +<https://github.com/json-schema-org/json-schema-spec/issues?q=is%3Aissue+propertydependencies>. |
| 12 | + |
| 13 | +For additional information, see <https://json-schema.org/>. |
| 14 | + |
| 15 | +To provide feedback, use this issue tracker or any of the communication methods |
| 16 | +listed on the homepage. |
| 17 | + |
| 18 | +## Table of Contents |
| 19 | + |
| 20 | +## Conventions and Terminology |
| 21 | + |
| 22 | +All conventions and terms used and defined by the JSON Schema Core specification |
| 23 | +also apply to this document. |
| 24 | + |
| 25 | +## Overview |
| 26 | + |
| 27 | +### Problem Statement |
| 28 | + |
| 29 | +<!-- What problem exists that needs solving? --> |
| 30 | + |
| 31 | +### Solution |
| 32 | + |
| 33 | +<!-- What is the solution? --> |
| 34 | + |
| 35 | +### Alternatives |
| 36 | + |
| 37 | +<!-- What other options have been considered? (summary, not detailed) --> |
| 38 | + |
| 39 | +### Limitations |
| 40 | + |
| 41 | +<!-- Are there any limitations inherent to the proposal? --> |
| 42 | + |
| 43 | +### Examples |
| 44 | + |
| 45 | +<!-- How will this feature be used? --> |
| 46 | + |
| 47 | +## Proposal |
| 48 | + |
| 49 | +### Target for Change |
| 50 | + |
| 51 | +<!-- Where does this change go? --> |
| 52 | + |
| 53 | +This proposal will add the {{propertyDependencies}} section contained herein as |
| 54 | +a subsection of JSON Schema Core, section 10.2.2 "Keywords for Applying |
| 55 | +Subschemas Conditionally." |
| 56 | + |
| 57 | +<!-- What is the exact change? --> |
| 58 | + |
| 59 | +### New Keyword: `propertyDependencies` {#propertyDependencies} |
| 60 | + |
| 61 | +This keyword specifies subschemas that are evaluated if the instance is an |
| 62 | +object and contains a certain property with a certain string value. |
| 63 | + |
| 64 | +This keyword's value MUST be an object. Each value in the object MUST be an |
| 65 | +object whose values MUST be valid JSON Schemas. |
| 66 | + |
| 67 | +If the outer object key is a property in the instance and the inner object key |
| 68 | +is equal to the value of that property, the entire instance must validate |
| 69 | +against the schema. Its use is dependent on the presence and value of the |
| 70 | +property. |
| 71 | + |
| 72 | +Omitting this keyword has the same behavior as an empty object. |
| 73 | + |
| 74 | +## Champions |
| 75 | + |
| 76 | +| Champion | Company | Email | URI | |
| 77 | +|----------------------------|---------|-------------------------|----------------------------------| |
| 78 | +| Jason Desrosiers | Postman | <tbd> | <https://github.com/jdesrosiers> | |
0 commit comments