-
-
Notifications
You must be signed in to change notification settings - Fork 315
Remove the notion of "canonical URIs" in favour of boundaried schema resources #1183
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
@jdesrosiers If I understand things correctly, this is the main practical implication here:
We already have this wording in §9.3 Compound Documents:
This might need some clarification, including on how a context schema resource (one in which other schema resources are embedded) should be treated when loading, e.g. is the embedded schema resource stripped out (in which case JSON Pointer fragments that cross the resource line will automatically no longer work) or left in (in which case they may or may not work depending on how the implementation handles them)? If it is stripped out, do we have "MUST be replaced with a We would probably also need language about copying the context's In §9.3.3 Validating (meaning "Validating Compound Documents"), we have:
This would follow pretty naturally if compound schemas had to be split up when loaded. The other paragraph in this section is:
This would presumably be dropped, unless we only want to mandate splitting of embedded resources with different We might also need to update §9.4.2 References to possible non-schemas because now the case of embedding a schema resource in a location not known to be a schema (e.g. because there is a keyword involved that is not recognized as an applicator or location keyword) also has significant implications: it will not be recognized and therefore not split out from the compound document. Does this cover the necessary changes? I would be in favor of this, as it simplifies the evaluation process and eliminates ambiguous JSON Pointer fragment behavior at the expense of a slight increase in schema load complexity. That seems like the right sort of trade-off, as a schema may be evaluated many times for each time it is loaded. It also helps remove the need for treating schema+instance and meta-schema+schema evaluation differently, which would be a good thing (the other part of what's needed for removal would be handled by #1281). |
I'm a bit tired and that part of the spec isn't fresh in my head right now, but it doesn't seem necessary for there to be that many changes. I wasn't proposing that any functionality actually change, just the way we describe it. I always try to avoid prescribing implementation details and I think much of what you're saying here sounds like implementation details. It seems to me that it should be enough to define embedded schemas as independent entities that are separate from the parent schema (which we do) and that the behavior of JSON Pointers that cross schema boundaries is undefined (which we sort of do in a confusing way). As long as you follow those constraints, you can implement it however you want. Breaking down compound schemas at load time seems the easiest thing to do to me, but I don't think it matters if someone handles it a different way as long as the behavior is the same. |
Agreed, I should have framed this more clearly as "is this an approach that captures what you want" rather than "is this the approach we should mandate." Whether it happens on schema load or at some other time, I think we do need to decide if the resources are actually split and stored as separate in-memory entities, or if they are left as one entity and the URI storage just points to the embedded location in the larger document.
If they are actually split, then:
If they are not split, then things pretty much stay the same, unless we want to outright forbid schema-crossing pointers from working (currently they are allowed to work, just not interoperably). |
I don't think we do need to decide. I think this is an implementation detail. Even if we choose to make the requirement more strict than just, "it's undefined", we don't need to care if the schemas are split up at any point. Someone could alternatively write a custom JSON Pointer implementation that is aware of schema resource boundaries and knows to stop at those boundaries.
I think we could drop that section without any changes. It's a natural consequence of constraints that are already well defined. It was for this reason that I recommended that that section not be included when it was first written. It's a helpful note, but it doesn't add any new constraints that need to be implemented. |
OK, so there's really no functionality change at all here. Implementations are just as free to bleed over schema resource boundaries as before. |
Yes, my intention wasn't change anything, just to describe it differently. Of course we could decide to be more strict about the boundary, but that would be a different issue. |
I feel like this could be a good step forward.
"Canonical URIs" is often confusing. We can simplify this by changing the language to talk about schema resource boundaries and not being able to reference across those boundaries without using the correct base URI.
I propose adding this to the
draft-next
milestone.Originally posted by @jdesrosiers in #937 (comment)
The text was updated successfully, but these errors were encountered: