Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add propertyDependencies keyword #1143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,25 @@
Omitting this keyword has the same behavior as an empty object.
</t>
</section>
<section title="propertyDependencies">
<t>
This keyword specifies subschemas that are evaluated if the instance is
an object and contains a certain property with a certain string value.
</t>
<t>
This keyword's value MUST be an object. Each value in the object MUST be
an object whose values MUST be valid JSON Schemas.
</t>
<t>
If the outer object key is a property in the instance and the inner
object key is equal to the value of that property, the entire instance
must validate against the schema. Its use is dependent on the presence
and value of the property.
</t>
<t>
Omitting this keyword has the same behavior as an empty object.
</t>
</section>
</section>
</section>
<section title="Keywords for Applying Subschemas to Child Instances">
Expand Down Expand Up @@ -3859,6 +3878,7 @@ https://example.com/schemas/common#/$defs/count/minimum
<list style="symbols">
<t>"contains" now applies to objects as well as arrays</t>
<t>Remove bookending requirement for "$dynamicRef"</t>
<t>Add "propertyDependencies" keyword</t>
</list>
</t>
<t hangText="draft-bhutton-json-schema-00">
Expand Down
9 changes: 9 additions & 0 deletions meta/applicator.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {}
},
"propertyDependencies": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": { "$dynamicRef": "#meta" },
"default": {}
},
"default": {}
},
"propertyNames": { "$dynamicRef": "#meta" },
"if": { "$dynamicRef": "#meta" },
"then": { "$dynamicRef": "#meta" },
Expand Down