-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow invalid literals #289
Conversation
looks good, thank you! |
Perhaps this is out of scope (and I'm not a URI templates expert), but I'm encountering OData-related problems with this change. OData queries make heavy use of quotes, but the library is treating quotes as invalid characters in template literals. Say I have the following template:
I would expect an expand call to produce:
or
I can work around this by replacing quotes with their encoded values, but that requires a big code change on my end. |
The (admittedly, not particularly well done) specification seems clear in this case. That said, I have no idea why this rule exists in the first place. I'm open to suggestions. Unless there's a good reason to throw an error, I'd rather have this rule relaxed. @keanu-delgado what's your opinion? (I'm currently on vacation so response time may vary…) |
Hm, single quotes However, the other characters in that set indicate an invalid uri by all standards, so I would prefer to continue error behavior for those. @craxal Would allowing single quotes fix the issues with OData? From what I can tell, OData does not use any other type of quote or invalid character - so maybe we can just remove that one? |
As far as I know, the single quotes were the only issue characters I encountered. All other characters are agreeably invalid. |
allowing |
@craxal thanks to @keanu-delgado the issue has been resolved as of v1.18.6 |
Excellent! Thanks for the quick response time. |
Hey there, here's another spec adherence proposal.
It seems that the parts of the template which are supposed to be copied over (literals) are not allowed to have a character in a specific set of disallowed characters.
This change throws an error during the parse if it finds one of these characters in a literal string.
From https://tools.ietf.org/html/rfc6570#section-2.1 :
And later, in the Appendix :