$id URI which are not URLs #205
-
Hello, I have read at https://json-schema.org/understanding-json-schema/structuring.html#id , that However, I believe that the author's intention was that it is an absolute URL (i.e. enforcing A URI can also be a URN, for example My question is: Is this OK to use a URN , or will this cause problems with JSON validators? (possible example) The background of my question: In my example it would be: This way, the JSON schema can be included in the Internet Draft without the requirement that it is hosted somewhere. If this is not what the author has intended, what is your idea to solve the problem? Also, in this case it would be good to update the specification to clarify that the URI must not be a URN. Thank you for your help and ideas. Kind regards, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
It definitely doesn't need to be hosted somewhere. "Note that this URI is an identifier and not necessarily a network locator. In the case of a network-addressable URL, a schema need not be downloadable from its canonical URI." - Core spec, section 8.2.1 I believe that URNs are fine, but I've requested a second opinion from the team. Interestingly, we don't have any tests around URNs in |
Beta Was this translation helpful? Give feedback.
-
Appendex A includes an example with I have also used tag: URIs successfully with more than one validator. |
Beta Was this translation helpful? Give feedback.
-
I suggest reading the section that comes before the one you linked called Schema identification. Common use of URI terminology doesn't always match up with the way the terms are used in RFC-3986, which is why I define how I use those terms before I used them. The wording used to describe There's also a box in that section that let's you know that URIs in JSON Schema are only identifiers. They are not intended to be fetched over HTTP. So, feel free to use an http scheme URI in your I-D if you wish, but URNs are fine too if you prefer. |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you very much for your detailed and helpful answers! Also, I'm happy to see that the JSON schema is also available as Internet Draft, and I am looking forward to this upcoming RFC :-) Kind regards, |
Beta Was this translation helpful? Give feedback.
I suggest reading the section that comes before the one you linked called Schema identification. Common use of URI terminology doesn't always match up with the way the terms are used in RFC-3986, which is why I define how I use those terms before I used them. The wording used to describe
$id
is correct and I think once you're aligned with how those terms are being used, it will make more sense.There's also a box in that section that let's you know that URIs in JSON Schema are only identifiers. They are not intended to be fetched over HTTP. So, feel free to use an http scheme URI in your I-D if you wish, but URNs are fine too if you prefer.