W3C home > Mailing lists > Public > uri@w3.org > August 2011

Re: URI templates: comma-separated variable lists

From: Joe Gregorio <joe@bitworking.org>
Date: Wed, 24 Aug 2011 11:20:29 -0400
Message-ID: <CA+-NybXi1jYo3fsedLpJ8=hPPYRYqxbJuHGQ-VV81h7K8UOo4g@mail.gmail.com>
To: James Manger <James@manger.com.au>
Cc: uri@w3.org
On Wed, Aug 24, 2011 at 9:50 AM, James Manger <James@manger.com.au> wrote:
> draft-gregorio-uritemplate-06.txt allows a comma-separated list of variables in any expression, regardless of the expression operator.
> However, a list should not be used with 5 of the 8 operators (+ # . / and no operator) because an expansion will be ambiguous if any variable in the list is undefined. The server cannot tell which value goes with which variable.

URI Templates are for expansion and not parsing, so the use case of
trying to figure out which value goes with which variable is not a
supported use case.
If it were then there would be more problems than with just lists. For
example, how would the template


match this incoming string:


a = "f"
b = "oobar"

or would it be:

  a = "foo"
  b = "bar"

or maybe

  a = "foobar"
  b = ""


> Consider if the template "{alpha,beta,gamma}" is expanded to "23,6". The user could have provided alpha=23 beta=6, or alpha=23 gamma=6, or beta=23 gamma=6 (or beta=[23,6] but that is a separate bug).
> A template like "{alpha,beta,gamma}" is almost certainly a mistake by the template author. It only makes any sense if all the variables are mandatory, but in that case it is clearer to use "{alpha},{beta},{gamma}" -- with no chance of ambiguity (and simpler lower-level expressions).
> I suggest changing the spec ABNF to only allow variable lists with operators that produce name=value pair (or drop variable lists entirely).
> --
> James Manger

Joe Gregorio        http://bitworking.org
Received on Wednesday, 24 August 2011 15:20:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:15 UTC