URI templates: comma-separated variable lists

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.

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

Received on Wednesday, 24 August 2011 13:50:38 UTC