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

Rename "dependencies" to "schemaDependencies" #614

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions hyper-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"properties": {
"additionalItems": { "$ref": "#" },
"additionalProperties": { "$ref": "#"},
"schemaDependencies": { "$ref": "#" },
"dependencies": {
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"schemaDependencies\" and \"requiredDependencies\"",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
Expand Down
46 changes: 23 additions & 23 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,18 +1099,18 @@

<section title="Keywords for Applying Subschemas Conditionally" anchor="conditional">
<t>
These keywords work together to implement conditional
application of a subschema based on the outcome of
another subschema.
Three of these keywords work together to implement conditional
application of a subschema based on the outcome of another subschema.
The fourth is a shortcut for a specific conditional case.
</t>
<t>
These keywords MUST NOT interact with each other across
"if", "then", and "else" MUST NOT interact with each other across
subschema boundaries. In other words, an "if" in one
branch of an "allOf" MUST NOT have an impact on a "then"
or "else" in another branch.
</t>
<t>
There is no default behavior for any of these keywords
There is no default behavior for "if", "then", or "else"
when they are not present. In particular, they MUST NOT
be treated as if present with an empty schema, and when
"if" is not present, both "then" and "else" MUST be
Expand Down Expand Up @@ -1181,6 +1181,23 @@
or annotation collection purposes, in such cases.
</t>
</section>
<section title="schemaDependencies">
<t>
This keyword specifies subschemas that are evaluated if the instance
is an object and contains a certain property.
</t>
<t>
This keyword's value MUST be an object.
Each value in the object MUST be a valid JSON Schema.
</t>
<t>
If the object key is a property in the instance, the entire
instance must validate against the dependency value.
</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 @@ -1327,24 +1344,6 @@
Omitting this keyword has the same behavior as an empty schema.
</t>
</section>

<section title="dependencies">
<t>
This keyword specifies subschemas that are evaluated if the instance
is an object and contains a certain property.
</t>
<t>
This keyword's value MUST be an object.
Each value in the object MUST be a valid JSON Schema.
</t>
<t>
If the object key is a property in the instance, the entire
instance must validate against the dependency value.
</t>
<t>
Omitting this keyword has the same behavior as an empty object.
</t>
</section>
</section>
</section>
</section>
Expand Down Expand Up @@ -1686,6 +1685,7 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
<t>Moved "definitions" from the Validation specification here as "$defs"</t>
<t>Moved applicator keywords from the Validation specification as their own vocabulary</t>
<t>Moved "dependencies" from the Validation specification, but only the schema form</t>
<t>Renamed "dependencies" to "schemaDependencies" to avoid compatibility issues</t>
</list>
</t>
<t hangText="draft-handrews-json-schema-01">
Expand Down
13 changes: 13 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,20 @@
"propertyNames": { "format": "regex" },
"default": {}
},
"schemaDependencies": {
"type": "object",
"additionalProperties": {
"$ref": "#"
}
},
"requiredDependencies": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/stringArray"
}
},
"dependencies": {
"$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"schemaDependencies\" and \"requiredDependencies\"",
"type": "object",
"additionalProperties": {
"anyOf": [
Expand Down