Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hyphens, i.e. - in a query parameter name raise an exception. #14

Closed
colinrymer opened this issue Apr 21, 2016 · 3 comments
Closed

Hyphens, i.e. - in a query parameter name raise an exception. #14

colinrymer opened this issue Apr 21, 2016 · 3 comments

Comments

@colinrymer
Copy link

Using this library to parse a template results in the following error:

Failed to parse URI template: /api/versions{?api-version}
 Error: SyntaxError: Expected "(", "*", ",", ":", "}" or [a-zA-Z0-9_.%] but "-" 

I'm happy to provide more information if necessary, but a cursory glance at this repo makes it seem like adding - to https://github.com/grncdr/uri-template/blob/master/index.pegjs#L22 would resolve this.

@andreineculau
Copy link
Collaborator

Please provide a reference to RFC 6570 where hyphen is specified as a valid parameter character. I don't see it.

21 apr. 2016 kl. 23:11 skrev Colin Rymer notifications@github.com:

Using this library to parse a template results in the following error:

Failed to parse URI template: /api/versions{?api-version}
Error: SyntaxError: Expected "(", "*", ",", ":", "}" or [a-zA-Z0-9_.%] but "-"
I'm happy to provide more information if necessary, but a cursory glance at this repo makes it seem like adding - to https://github.com/grncdr/uri-template/blob/master/index.pegjs#L22 would resolve this.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@c0
Copy link

c0 commented Apr 22, 2016

It's a part of the unreserved set:

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"

https://tools.ietf.org/html/rfc6570

@andreineculau
Copy link
Collaborator

unreserved is irrelevant. Meanwhile I looked at RFC 6570 myself.

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

varchar says "-" is not a valid parameter character. Closing, and apiaryio/dredd#460 should be closed as well IMO.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants