-
-
Notifications
You must be signed in to change notification settings - Fork 311
Meta-schemas for vocabularies seem to have incomplete lists of used vocabularies #964
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
Hey @epoberezkin, yes you're missing something here =]
https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.1.2
If a JSON Schema wants to use a different dialect or create a new dialect, you can do this by first creating the meta-schema which identifies the vocabularies used, and then use the Shout if you need any further clarification. I find Appendix D very helpful in understanding how this fits together. |
To clarify, the core meta-schema you include, uses the full JSON Schema dialect, but is itself JUST the meta-schema for the core vocabulary. |
The intuitive way to think about this is that schema keywords describe the instance. The only exceptions are Everything else, including |
That makes sense, that is what I initially thought based on that sentence you quoted, but there is another place in the spec that made me think that the schema can override vocabularies defined in its meta-schema:
This implies that the $vocabulary can be present in the schema to define the vocabularies it is using. Or does it refer to the meta-schema of the meta-schema? Further, if this is not correct, then I do not understand why would core, applicator etc. metaschemas have $vocabulary at all? Firstly, they are not expected to be used as meta-schemas on their own - maybe core can be used on its own, but others require core. Secondly, if there is a scenario when they would be used as meta-schemas, they should at least include core vocabulary, and, maybe, applicator and some other vocabularies as well, as it is unlikely you can construct a schema without core and applicator... I am still missing something here... |
It should probably read Translation: If someone uses an old pre-
I mean, you could use them that way, and it seemed better to go ahead and put the appropriate value in than to leave it out. Leaving it out when the spec makes a big deal out of
I think we wrote it such that core is always assumed to be present, even if you don't list it, but you SHOULD list it? I'd have to go dig through to find that. But you have to assume core to even follow
A meta-schema should only declare the vocabularies that it describes. The validation meta-schema only describes the validation assertions, so that's the only vocabulary (other than core, which as noted is a special case) that it declares. Is it useful on its own like that? Not very. I can't imagine using it on its own. Is it correct on its own like that? Yes. It is correct and consistent which seemed more important than doing something inconsistent for single-vocabulary meta-schemas just because they're unlikely to be used on their own in the real world. |
The
footnote 1: I don't think it's valid to use an individual meta/* document as a metaschema on its own though -- it doesn't spell out the full set of vocabularies for a schema to be useful. e.g. a schema with just applicator keywords can't do much (via So, the issue I'm having is: when parsing a schema (either as a regular schema for the purposes of evaluating instance data, or as a metaschema for determining which vocabularies it supports), what do we do when encountering a |
I found the duality of the |
|
This isn't terribly helpful, I'm afraid. I'm still not sure what to do re my question above:
|
Nothing. It's only useful in the "top-level meta-schema". It initially seemed like a duality to me, but in actual fact, it isn't. If you think about it further, you can actually use this data to automagically construct yourself a new dialect based on a set of vocabulary meta-schemas, I think. But that's more an aside.
This is exactly correct. It's only meta-schemas which are "referenced" by use of |
@karenetheridge that reply was responding to @jdesrosiers about A meta-schema should declare the vocabularies that it describes, and no more. So the applicator single-vocabulary meta-schema declares schemas that use it directly only rely on applicator (and core) semantics. Somewhere there is an issue with a use case for this- basically using only applicators and an additional annotation vocabulary for, I think, UI generation. It was a bit contrived but had some relation to an actual project, and is the reason that the applicator vocabulary is in the core spec as a separate vocabulary. So to address
You don't think so, but you don't define the entire set of use cases ;-P Others have come up with use cases where this is at least plausible. I will admit, not compelling- I'm with you there! But plausible. More importantly, people will extend the regular schema dialect and |
@epoberezkin was your question sufficiently answered (or have you sorted it out elsewhere and no longer need info here)? @karenetheridge @jdesrosiers @Relequestual the discussion drifted a ways off track from just answering the original question. If there is anything else that needs further discussion, can we file that separately and close this? |
thank you! |
I'm going to reserve comment on usage of $vocabulary until I actually successfully implement it, as I'll be better able to articulate the problems that I see with it (or someone will tell me that I'm understanding it wrong, and we'll massage the spec wording to be more clear). |
@karenetheridge that sounds like you're not specifically worried about the question here, so it's probably best if you just file new issues if and when you find stuff with vocabularies during implementation. I'm going to close this particular issue since the original question is resolved- the current usage is well-defined. The questions around whether the current usage is long-term desirable are better addressed in #1098, which directly addresses the fact that a lot of people are confused by the current wording. |
Maybe it was reported already - sorry if I didn't find it.
For example, https://json-schema.org/draft/2019-09/meta/core uses applicator and other vocabularies but includes only core.
https://json-schema.org/draft/2019-09/meta/applicator uses core and others, but includes only applicator.
etc.
Am I missing something?
The text was updated successfully, but these errors were encountered: