URI format - does it include relative references?

59 views
Skip to first unread message

Roy Walmsley

unread,
Jul 8, 2016, 5:04:33 AM7/8/16
to JSON Schema
According to the latest schema validation specification (http://json-schema.org/latest/json-schema-validation.html), at clause 7.3.6 the "uri" format for a string is described. Clause 7.3.6.2 states that "A string instance is valid against this attribute if it is a valid URI, according to [RFC3986] (Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005.).".

Reviewing RFC 3986, and looking at clause 4.1 URI Reference the following text is noteworthy:

4.1 URI Reference
 
URI-reference is used to denote the most common usage of a resource identifier.
 
      URI-reference = URI / relative-ref
 
A URI-reference is either a URI or a relative reference.  If the URI-reference's prefix does not match the syntax of a scheme followed by its colon separator, then the URI-reference is a relative reference.


 So, in the JSON schema specification, is the term "uri" referring to a "URI" or a "URI-Reference" of RFC 3986? Does this need clarification in the specification? The distinction is important for validation tools.

Austin William Wright

unread,
Sep 13, 2016, 10:49:44 AM9/13/16
to JSON Schema
This language is being fixed in the current draft. See <https://github.com/json-schema-org/json-schema-spec> for details, and file an issue there if you spot any problems.

In many places, "uri" is used when we do (in fact) mean "URI reference", and maybe vice-versa.

You'll have to use common sense to figure out what was actually intended, unfortunately.

As far as I can remember:

"$schama" must be a URI (i.e. absolute)
"$ref" and "id" must be a URI Reference (i.e. may be relative, also "id" changes the base URI)
"href" must be a URI Template that produces a URI Reference (I think? I forget off-hand what the base URI would be for URI References here, though)

Sorry for the late reply.

Austin.
Reply all
Reply to author
Forward
0 new messages