-
-
Notifications
You must be signed in to change notification settings - Fork 308
Restriction of processing $vocabulary to meta-schemas is unnecessary and confusing #1098
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
This comment has been minimized.
This comment has been minimized.
Note: @Relequestual suggested that I hide his comment just above this one- I'll add more here soon to clarify what the topic is that I'm trying to address. Although the off-topicness illustrates my point that |
I think this ends up just being a clarification. The statement The "$vocabulary" keyword MUST be ignored in schema documents that are not being processed as a meta-schema. is not testable AFAIK (paging @karenetheridge ) so simply observing that it naturally would not have an effect is a clarification. We cannot state that it MUST be treated as an annotation in the patch release (and that's worth further thought anyway), so I think I'll just put in a CREF noting that that is the current direction of thought, which we can formalize one way or the other in the next non-patch draft. If anyone thinks this should not go in, simply object here or on the PR and that's enough to bump it out of the patch release. |
We can test for this by using an unknown $vocabulary URI in a schema and checking that validation can still proceed successfully. |
@karenetheridge yeah, that's definitely testable. Having thought about it more, I think I can work this out so that the " |
Agreed. ..But when we get there, I would propose having |
@karenetheridge Given:
Those keywords operate as follows:
So |
Closing in favor of #1281 where I think I did a much better job explaining this. |
I've noticed that people often think of
$vocabulary
as a very strange case of keyword, specifically asking why it is in the meta-schema and not the schema. The answer is that like all keywords in a schema, it describes the instance.$vocabulary
is only meaningful when the instance is a schema (and therefore$vocabulary
is being processed in a meta-schema).But it's not harmful, except for performance, to "process" it in a normal schema. It has the same semantics, meaning that it indicates the JSON Schema keywords that could be used in the instance... which only makes sense if the instance is a schema.
But
$vocabulary
is essentially an annotation. It is applied to the instance, and the application (the same schema validator that was already running) uses it to load vocabulary support if needed. Annotating a non-schema instance with$vocabulary
does nothing.I think we can replace the last paragraph of §8.1.2:
with something about
$vocabulary
behaving as an annotation, which would then allow us to completely remove §9.1.3 Detecting a Meta-Schema. Or just relax it from a MUST to a SHOULD or even a MAY, as there may well be some optimizations possible.But I never really liked making meta-schema processing special, and having taken a break to come back and look at this with fresh eyes, I don't think it's needed at all. And maybe that would cut down on confusion about the nature and placement of
$vocabulary
. It truly is an annotation, which is further processed by the application that called the validator, which just happens to be the JSON Schema implementation itself. It may be worth a note that it's entirely reasonably to just look in a referenced meta-schema for$vocabulary
in order to load features if validation against the meta-schema is turned off.The text was updated successfully, but these errors were encountered: