Re: Feedback on draft-gregorio-uritemplate-00

+1 to dropping component spanning and doing percent-encoding during  
substitution, as well as UTF-8.

However, this will require that the data model for the input to  
substitution be formalized more, as others have pointed out -- which  
I think is a good thing.

Consider:
a = "foo/bar"

http://www.example.com/{a}
http://www.example.com/foo?path={a}

The first will need the '/' escaped; the second will not.

So, the input data model needs to be something like:

{'a': ('foo/bar', PATH_SEGMENT)}

In practice, this might mean that particular uses of templates will  
need to specify the types of their variables.

This allows other interesting things -- like datatyping, as requested  
-- to be slotted in. E.g.,

{'a=(int)': ('1', TYPED_QUERY_ARG)}

http://www.example.com/foo?{a=(int)} -> http://www.example.com/foo?a=1

I'm still not sure if this latter convention is a good idea, but I do  
like having the extensibility necessary to enable it, if necessary.



On 2006/10/05, at 4:13 PM, James M Snell wrote:

> Joe Gregorio wrote:
>> On 10/5/06, Sam Ruby <rubys@intertwingly.net> wrote:
>>> My vote: specify unicode and utf-8 throughout.  And ditch the  
>>> perceived
>>> requirement to allow template variables to optionally span multiple
>>> segments, depending on the data values allowed.
>>
>> +1
>
> One challenge I've had with the spec as it stands now is that template
> replacement values are not defined.  If we don't want to allow a
> replacement to span multiple segments, then I think we're going to  
> have
> to nail this down.
>
> A template-var would be replaced by a template-value, which MUST match
> the production:
>
>   template-value = scheme / userinfo / host / port / reg-name /
>                    segment / segment-nz / segment-nz-nc / query /
>                    fragment
>
> Any characters in the replacement that do not fit the production  
> MUST be
> percent-encoded.  Obviously the validity of the replacement is still
> ultimately dependent on whether a valid URI is produced or not.
>
> Also, given the feedback provided so far, I'm definitely comfortable
> with requiring that the template processor perform the percent- 
> encoding.
>
> Examples:
>
> template-variable     replacement         template-value
> ========================================================
>   a             =     "foo"             =   "foo"
>   b             =     "foo bar"         =   "foo%20bar"
>   c             =     "foo/bar"         =   "foo%2Fbar"
>   d             =     "foo@bar"         =   "foo@bar"
>   e             =     "fóó"             =   "f%C3%B3%C3%B3"
>   f             =     "foo?bar"         =   "foo%3Fbar"
>   g             =     "foo#bar"         =   "foo%23bar"
>   h             =     "foo:bar"         =   "foo:bar"
>   i             =     "foo%20bar"       =   "foo%2520bar"
>
> - James
>


--
Mark Nottingham     http://www.mnot.net/

Received on Saturday, 7 October 2006 02:25:33 UTC