uri-templates/uritemplate-test

Add more complicated variable names

Closed this issue · 11 comments

Currently all variables are alpha-only. We could use some numbers, underscores, dots and pct-encoded characters ( see: http://tools.ietf.org/html/rfc6570#section-2.3 ).

mnot commented

Yes.

I've started on a few tests over here:

https://github.com/damnhandy/uritemplate-test/blob/master/extended-tests.json

Is this kind of what you were thinking @hannesg ?

@damnhandy Yep, "last.name" and "Some%20Thing" are good examples.

On second thought, I'm not so sure last.name is valid. Section 2.3 of the spec states:

     varspec       =  varname [ modifier-level4 ]
     varname       =  varchar *( ["."] varchar )
     varchar       =  ALPHA / DIGIT / "_" / pct-encoded

My ABNF skills are far from awesome, but if I read that correctly, the . isn't legal in a varname? Or am I just reading it wrong?

mnot commented

According to that, not legal.

Cheers,

On 21/05/2012, at 11:28 AM, Ryan J. McDonough wrote:

On second thought, I'm not so sure last.name is valid. Section 2.3 of the spec states:

    varspec       =  varname [ modifier-level4 ]
    varname       =  varchar *( ["."] varchar )
    varchar       =  ALPHA / DIGIT / "_" / pct-encoded

My ABNF skills are far from awesome, but if I read that correctly, the . isn't legal in a varname? Or am I just reading it wrong?


Reply to this email directly or view it on GitHub:
#3 (comment)

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

Nope, is legal. You can read the spec as following:

A varspec is a varname optionally followed by a modifier-level4.
A varname is a varchar followed by a sequence of varchar each optionally preceded by ".".
A varchar is from ALPHA, DIGIT, "_" or pct-encoded.

It's legal but it may not be the first or last character.

I think you're right @hannesg , I overlooked the quotes on ["."]. I thought it was optional string concatenation as in section 2.3 Like I said, my ABNF skills still need work ;)

mnot commented

argh, missed that, sorry; I should have looked more closely.

You're welcome ;)

Making the fix...

mnot commented

Think we can close this for now (though there may be more...)