Clarifying the "uri" format

50 views
Skip to first unread message

Ron R

unread,
Oct 9, 2014, 2:14:12 PM10/9/14
to json-...@googlegroups.com
Seems like I've been gathering questions lately regarding json-schema, so here's another one.

We sometimes set a property name to be with the format of a "uri".
According to the json schema validation docs, the validation of "uri" is:

A string instance is valid against this attribute if it is a valid URI, according to [RFC3986].

Now, I didn't read the whole RFC, but looking at the ABNF (http://xml2rfc.ietf.org/public/rfc/html/rfc3986.html#collected-abnf) it seems that the "scheme" part of the uri is not optional.

However, when testing validation against a "uri" formatted string, the value of "www.google.com" is acceptable (that is, it doesn't have to be "http://www.google.com").

Can anyone please clarify how the validation works? Is there support for partial uri's? Is that described somewhere in the RFC?

Geraint

unread,
Oct 20, 2014, 11:54:38 AM10/20/14
to json-...@googlegroups.com
Good question. :)

Technically, I agree "uri" should be a full URI with all the components.  However, people are generally using URI References here, because in vernacular use a URI can be "relative" or "absolute".

It's been proposed to explicitly state that "uri"s must be absolute, and use "uri-ref" for anything that could be relative.  I think this is a noble idea, but I'm worried that it would conflict with existing usage, so it's not so simple.

Geraint
Reply all
Reply to author
Forward
0 new messages