Replies: 5 comments 30 replies
-
Currently We had discusssed before how having core as a vocab didn't make sense because its purpose was to define processing rules. This was the first I had heard you mention having a separate keyword for processing rules, which I expect this proposal is intended to formalize. Since we're effectively pulling "core" out of I think this would resolve the duplication issue since it would be located in the document within |
Beta Was this translation helpful? Give feedback.
-
I agree with almost all of this. However, I would propose one change. Instead of introducing a new keyword for the processing rules, we can introduce a new variable for declaring the dialect schema. So, Both this and the original proposal split the functionality of |
Beta Was this translation helpful? Give feedback.
-
(I thought this deserved its own thread). I'm definitely willing to explore the options. The only option that comes to mind so far is to allow the bootstrap identifying keyword to default to the latest version, but that's not great for compatibility. I'm continuing to think about it and I look forward to hearing other ideas. |
Beta Was this translation helpful? Give feedback.
-
I'm still researching this, but I'm coming to a finding that if we tighten up interoperability rules around forwards compatibility, then such a keyword should not be necessary yet; it should only be necessary is in the future, and only to do certain things. Here is why:
If we define a new "bootstrapping" process in the future, then it would either:
If we make all three of these conditions an error (currently only (2) seems to be an error), then I think this would solve the problem you're identifying. |
Beta Was this translation helpful? Give feedback.
-
This proposal will be re-evaluated in the context of the ongoing SDLC discussion. I'm going to lock this discussion, and most likely start a new one once I have an updated concept. |
Beta Was this translation helpful? Give feedback.
-
This proposal is related to #198 Media type registration, but I think it will be easiest if we can debate it separately here and integrate it there if it turns out to be suitable.
Bootstrapping rules are the things an implementation needs to know in order to figure out how to even begin processing a schema.
$schema
for a value that might directly indicate the draft is a bootstrapping rule.$vocabulary
in the meta-schema, and that the "core" vocabulary is the most important one for identifying the draft, would be another.$defs
for schemas that have$id
so that you can resolve an embedded meta-schema is arguably a bootstrapping rule.pathStart
to disambiguate which schema applies to different parts of a compound document (up through draft-03, or draft-04 if using Hyper-Schema)The bootstrapping rules are smaller than the full processing rules or the core vocabulary.
$ref
operates by replacing its context or as a normal by-reference applicator is a processing rule, but not a bootstrapping rule.$comment
is defined or not is part of the core vocabulary, but not a bootstrapping rule.As of 2020-12, the full bootstrapping process involves following
$schema
references until reaching a schema that has its own$id
as its$schema
, at which point you can check its$vocabulary
to determine its own processing rules. Then you must walk back out, with each meta-schema determining the processing rules of the previous one, until you reach the processing rules of the (non-meta) schema.In practice, this can usually be short-circuited, but the general case is expensive and requires access to at least two resources. Furthermore,
$schema
and$vocabulary
do much more complex things than just identify the bootstrapping rules, which means that they are subject to change for a wide variety of reasons (particularly the relatively recent$vocabulary
). Specifically, they signal:$ref
is a separate specification or notIf we register a media type now that is intended to continue working for the future, and rely on
$schema
(with a URI value identifying the meta-schema) for bootstrapping, then we are committing to one of the following:$schema
URIs that convey the information, which violates the concept of URIs as opaque and introduces opportunities for custom meta-schema URIs to get the internal syntax wrongWhile current standard meta-schema URIs encode the draft in the URI, this is primarily for human convenience. It is also not a universal internal syntax, as custom meta-schema URIs are not expected to have a draft identifier embedded within them. So while standard meta-schema URIs have a human-friendly internal convention, in technical terms they remain opaque identifiers, as they should.
Another drawback to defining an internal syntax such as query parameters is that we would have to get the syntax right the first time.
None of this positions us well for the future.
A better approach would be to introduce a new keyword, which I'll call
$jsonSchema
(exact name TBD if we go this route), that appears in the schema (not the meta-schema) and identifies the bootstrapping rules (and only the bootstrapping rules).This would allow determining the bootstrapping rules within the single schema resource. Should those rules indicate looking through
$schema
, the meta-schema could also declare its own bootstrapping rules and not require further examination of meta-meta-meta-...schemas.$jsonSchema
's value should be an opaque identifier, probably a URI. It should not be a semantic versioning number, as the guarantees that semver attempts to make do not fit our situation well.Even if we were to continue the current style of draft publication, it would not change every draft. While this is not intended to address past drafts, as examples there are no changes in bootstrapping rules between draft-06 and draft-07, or between 2019-09 and 2020-12.
This would preserve the intent of
$schema
as a freely customizable value. It would decouple the processing rules from the core vocabulary or any question of draft vs version vs whatever. Aside from the keywords involved in the bootstrapping process, most vocabularies will not care about that process, and should function with any bootstrapping rules.All bootstrapping keywords should be part of the standard core vocabulary, making it the only one with a direct dependency. But they are not the same thing (
$recursive*
vs$dynamic*
changed in 2019-09 to 2020-12, but the bootstrapping rules are the same as by the time you have bootstrapped, you know which of them to expect - you do not need to fully evaluate the meta-schema in order to bootstrap).If we wanted to move vocabulary or even keyword declaration into the schema (rather than meta-schema), this could be done as an updated set of bootstrapping rules. Implementations that do not recognize the new rules MUST refuse to process the schema.
An analogous media type parameter would be added, allowing schema content negotiation based on processing rules. This could allow some sort of graceful degradation when outdated implementations are all that is available.
A possible drawback would be needing to specify both
$jsonSchema
and$schema
. This is worth more thought than I've been able to give it, but in the short term, we could define default bootstrapping rules in the absence of$jsonSchema
, allowing things to continue to function more-or-less as they do now. But once we figure out a way to avoid this duplication, then a new bootstrapping rules identifier would be used.Another possible way to future-proof this would be to make
$jsonSchema
an object with one permanently defined key, e.g.$rules
, that actually defines the bootstrapping rules.There are no doubt many possibilities. We should explore those rather than dismissing this proposal simply because of the possible duplication (although it may be dismissed for other reasons).
pinging @jdesrosiers in particular
Beta Was this translation helpful? Give feedback.
All reactions