-
-
Notifications
You must be signed in to change notification settings - Fork 314
Section 9.2.1 (*Of keywords) is non-specific about sequencing #910
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
do you mean the sequence of which comes first among oneOf, anyOf, allOf when multiple are present? or the sequence of evaluating the subschemas in the *Of arrays? if the former, I think that since *Of are not listed in the exceptions to keyword independence in https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.1 , they can be assumed to be independent and not not care about sequence. if you mean the latter, I think that the way each of the keywords is defined is clear that order deosn't matter. |
@gregsdennis there is nothing about ordering that would change the outcome of these keywords at all. Ordering is an implementation detail and best we stay silent on it. |
I don't mean the sequencing of the keywords, but rather the sequence of evaluation of their subschemas. For instance, given the schema/instance in the test case I linked: {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"allOf":[
{
"properties": {
"foo": true
}
},
{
"unevaluatedProperties": false
}
]
}
{
"foo": 1
} If an implementation were to get things wrong and implement these to run in order rather than independently, the But I feel that if the spec is clear that the sequence of subschemas is unimportant, the implementor would get this right more than not. |
@gregsdennis I was talking about the evaluation of their subschemas. That We process one schema object at a time, and a schema object's subschemas need to be processed before it can be fully processed itself. I decided that putting a restriction on processing order of keywords within a schema object was OK, because |
So, yes I see the problem you mention, but I specifically made a point to avoid it with |
So it seems the consensus is that sequence of subschema evaluation does not matter. I just think it should be explicitly stated. |
@gregsdennis I'd like to do a holistic wording/flow review after I finish the big things. In which I will answer questions and generally endorse whatever seems to make things the most clear without bloating the spec. But let's put this on hold until then. |
Just to check my understanding here, are we saying that the annotations from applying subschemas from an applicator which has multiple schemas is not complete till it has applied all the schemas? If so, this (issue and the related test that was added) makes sense. Otherwise, can someone explain this to me please? |
I thought of another case where ordering is significant - take my answer to this SO question here -- https://stackoverflow.com/a/62958916/40468 If that (in my implementation, I evaluate all the core ( |
@karenetheridge I'm not sure that answer is correct. It is not useful to put it inside of a referenced schema, unless that schema has further complex applicator structure.
|
@karenetheridge My thoughts on this are, all applicators have to be processed before Essentially, this boils down to, there IS NO order in which an applicator with multiple schemas to apply should apply them in. They are "locally" all applied at the same time, and therefore cannot use the annotations from another sibling schema to determin their results. These two schemas are not equivilent...
Do you see that @gregsdennis ? Is there anything we could change in the spec to make this clearer? @handrews do you think it's worth defining that the annotation collection from subschemas being applied through a multi-applicator keyword are not "fully collected" / "useable" / [something else] till all subschemas are applied? Maybe something like "Annotation collection from the result of applying subschemas from an applicator keyword that may contain multiple subschemas happens simultaneously. As such, keywords which rely on annotation MUST NOT use annotations collected from sibling schema, because sibling schemas are logically applied simultaneously." |
That sounds good to me. |
@Relequestual @gregsdennis I'd like to understand why this language:
was not sufficient to convey this behavior. Because depending on the answer there may be other stuff to update. |
@handrews when you quote that, it makes perfect sense. I think the confusion (forgetting that specific clause) is down to how we (I) often phrase it as "see through applicator keywords" without the "adjacent" qualifier. Maybe some IETF requirements keyword (rfc2119) could be added in the related sections to draw peoples attention to it better? (Kind of as an aside, I feel like quite a bit of the spec could be rephrased to include requirement keywords.) |
Note that the term "adjacent keywords" is more explicitly described in PR #981. Do we need to do more here? |
I think some of my premise was wrong. In [this comment] I hypothesize that an implementor could get something wrong, and in that case the evaluation wouldn't work right. But I don't think that's an issue that the spec needs to handle. It seems that several test cases (in the test suite) could be created to verrify that an implementation has it right. Furthermore, the example I give doesn't describe an issue of ordering but one of adjacent subschema independence. In the example, |
@gregsdennis thanks, it sounds like we can just drop #992 and the only clarification that is needed (about what "adjacent keywords" means is in #981). BTW, in terms of subschema independence, if there were really complications there, it's theoretically possible that evaluating a 3-branch |
In case anyone wants to know what a non-commutative, non-associative system looks like: https://en.wikipedia.org/wiki/Octonion 😆 |
@gregsdennis given #981 is merged now, can this issue be closed? |
I'm not seeing how that PR addresses this issue. That PR is all about It mentions "adjacent keywords", but this is about "adjacent subschemas". |
This may be irrelevant to the test case that highlighted the issue to me, but it seems that the spec should say whether sequence of evaluation is important.
The text was updated successfully, but these errors were encountered: