Description
While working on specifying fragment identifier rules ( see #144 ) I've been trying to bring JSON Schema's language around base URIs and fragments in line with other media types. I've noticed that while XML and HTML both allow for changing a document's base URI, they both only allow one base URI per document. This is much less confusing than the current JSON Schema approach of allowing each schema level to set its own base URI.
What are the use cases that motivated this? I can come up with:
- Simple identifiers for internal
$ref
. - Bundling multiple schemas with base URIs that differ by more than just the fragment together into one JSON document.
The internal reference use case could be handled by introducing an anchor
(or $anchor
) keyword with exactly the same functionality as "anchor" in HTML or other hypermedia systems. The anchor would be usable as a plain word fragment identifier.
I don't understand the bundling use case very well. What problem is it solving? I looked on the old wiki and could not find any discussion of usage, but I vaguely recall someone bringing up the bundling idea.
For me, I "bundle" schemas, for instance for an API, by putting them in the definitions
section and addressing them with JSON Pointer fragments. Even if I need to address them across different files, that works fine. Likewise for setting a profile URI.
Using id
for anything other than an initial base URI at the root schema or a simple plain word anchor is horribly confusing. What does it give us? What am I missing?