W3C home > Mailing lists > Public > uri@w3.org > November 2008

Re: URI Templates: done or dead?

From: Robert Brewer <fumanchu@aminus.org>
Date: Thu, 6 Nov 2008 14:02:09 -0800
Message-ID: <F1962646D3B64642B7C9A06068EE1E64057EE448@ex10.hostedexchange.local>
To: <uri@w3.org>

Roy Fielding wrote:
> Something like
>
>    var   = "value";
>    undef = null;
>    empty = "";
>    list  = [ "val1", "val2", "val3" ];
>    keys  = [ "key1", "val1", "key2", "val2", "key3", "val3" ];
>    path  = "/foo/bar"
>    x     = "1024";
>    y     = "768";
>
> {var}                     value
> {var=default}             value
> {undef=default}           default
> {var:3}                   val
> {x,y}                     1024,768
> {?x,y}                    ?x=1024&y=768
> {?x,y,empty}              ?x=1024&y=768&empty=
> {?x,y,undef}              ?x=1024&y=768
> {;x,y}                    ;x=1024;y=768
> {;x,y,empty}              ;x=1024;y=768;empty
> {;x,y,undef}              ;x=1024;y=768
> {/list,x}                 /val1/val2/val3/1024
> {+path}/here              /foo/bar/here
> {+path,x}/here            /foo/bar,1024/here
> {+path}{x}/here           /foo/bar1024/here
> {+empty}/here             /here

So we have constructions for empty variables and undefined variables
producing valid URI's. What I have yet to see in either proposal (but is
in e.g. WADL) is a way to specify that a given expansion variable MUST
be defined, else raise an error because no valid URI can be constructed
if it is missing. For example, if I have the desired target URI
"/users/1234/first_name", I can't write "/users/{user_id}/first_name"
(using Joe's URI Template draft-03) because that will allow
"/users//first_name" if user_id is undefined. I don't think I can use
the above (which otherwise looks quite nice) for the same reasons.
Perhaps a trailing "!" could be used to require certain variables, e.g.
"{?x,y,undef!}"

Thoughts? Am I missing some glaring interop principle by wanting this?


Robert Brewer
fumanchu@aminus.org
Received on Friday, 7 November 2008 08:23:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:41 GMT