-
-
Notifications
You must be signed in to change notification settings - Fork 308
Move "dependencies" to applicability group #528
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
Comments
I agree that It does have something of a hybrid nature, but because the assertion it makes is which property definitions (or which dependency schemas) should be considered applicable, and it has to live somewhere, applicability seems to me like a more logical home for it. |
Locking this as it is an offshoot of #513. |
Unlocking this as 513 has been definitively resolved. Anyone re-opening of 513's topics in this issue will get a warning if it seems accidental. If the focus of the comment is purely revisiting 513, I will remove the comment to keep this issue on-topic (and we will determine a consistent policy on this via #529). |
I can see the view of the schema form of However, I am vehemently against the string array form of This is part of what led me to mark I could get behind the idea of keeping the schema form of Thoughts? |
This is pretty much my ideal outcome. I don't think that the string form of dependencies is necessary - |
or "dependentProperties"? I always get confused what depends on what... |
|
or "requiredDependencies" :) If I am correct and the property value is the list of "dependencies" of the property key, than "requiredDependencies" is better (also closer to the current name that implies the same). If it's the opposite (the key is a "dependency" of each property in the list), then "dependentRequired" is better. As I wrote, I am confused, but I now think it's the first... Now we can spend another 100 comments arguing about the definition of the word "dependency" ;) (that's a joke). As it was {
"exclusiveMaximum": ["maximum"]
} then, probably, "maximum" is a dependency of "exclusiveMaximum" (i.e. "maximum" is required to define "exclusiveMaximum"). So "requiredDependencies" makes the most sense to me now :) But whatever. |
@handrews And yes, I agree that
conditional "required", sort of. |
Let's go with:
We can keep kicking the |
Merged #573. |
As requested by @handrews in #513 (comment)
The fact you can rewrite a keyword using if/then/else/required doesn't mean that it makes the keyword itself asserting any conditions. This schema:
can be rewritten as
"properties" keyword still belongs to the applicability group, even though you can rewrite it using "required", same as "dependencies".
Compare keywords definitions (ignoring property syntax of "dependencies" for now, I'll come back to it later):
"properties" (http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4):
"dependencies" (http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7):
So, for "properties", if a property name appears in the instance, you have to apply a corresponding subschema to the child instance.
For "dependencies", if a property name appears in the instance, you have to apply a corresponding subschema to the current instance.
The logic of "properties" and "dependencies" only differs in that the former applies subschemas to the child instance, and the latter to the current instance. Neither of them is making assertions on their own.
Now back to the property syntax of "dependencies". We have two possible points of view here:
<array of strings>
as a shortcut for{"required": <array of strings>}
. It's not dissimilar from the boolean form of the schema, where you can usefalse
as a shortcut for{"not":{}}
. In this case, "dependencies" keyword still applies a certain schema to the current instance, without making any assertions of its own.Regardless which way of looking at property syntax of "dependencies" we prefer, the schema syntax of "dependencies" still belongs to the applicability group, as it only uses a defined logic to apply subschemas to the current instance, without making any assertions of its own, which is consistent with how applicability is defined.
The text was updated successfully, but these errors were encountered: