Replies: 2 comments 14 replies
-
It depends on which of the Therefore, the evaluation result depends on keyword execution order, which is not well-defined by the specification. The only exceptions to the indeterminate ordering are not well-stated in the spec, but are implicit from property definitions:
IMO the spec should clearly state that all of the core vocabulary keywords MUST be evaluated first before all other vocabularies, and then the $ref ambiguity described by this thread will be resolved. |
Beta Was this translation helpful? Give feedback.
-
Generally speaking, regardless of how you loaded a schema resource, it should be available under its I would strongly advise against mixing addressing modes like this. It's the mixing that introduces a dependency on the keyword order. If you use consistent addressing, it doesn't matter which is resolved first. Even if there was a defined ordering, it does not seem like a good idea to rely on it to establish an alternate addressing approach. You could easily break things by a fairly benign-seeming schema change. If you want to load schemas from disk, do that up front. If you're writing an implementation, one strategy I've seen is registering handlers for URI resolution, which would (for example) allow you to intercept a URI and convert it to a local filesystem path during testing, but do a network retrieval in production. I would say it's a "best practice" to separate the identification and location of schemas. Identification needs to remain stable, but location might change depending on the environment. You don't want to have to edit your schemas for that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Consider the following two schema documents:
Document 1: Retrieval URI irrelevant:
Document 2: Local filesystem at /path/to/local-schema.json:
Now, make the following assumptions about an application that is processing schemas:
So, when processing document 1, the application sees the reference to
file:///path/to/local-schema.json#/$defs/def1
, notes that it is not an already-known identifier and so treats it as a URL, retrieves document 2, resolves the fragment, all is well.However, my question is: upon retrieving document 2, should document 2 now exist in the space of schemas that the application is aware of (...even if only in some sort of limited scope)?
For example, if document 1 were, instead, the following:
Should any of those other reference work? They would all resolve to the absolute URI
xri://+this.discussion/schema2
with fragments, which matches document 2.I have follow up questions that depend on whatever the answer is here, I'll leave them out for now.
Beta Was this translation helpful? Give feedback.
All reactions