-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow special characters on URI template expressions #252
Comments
Ah this is unfortunate. According to URI Template RFC 6570 – Furthermore it is in list of reserved in section 1.5. However reading on:
I guess we can exclude Thoughts? |
I think you might have found a small mismatch between RFC6570 and the OData spec, because my interpretation of section 2.2 is that the reason As you mention correctly RFC6570 section 2.3 excludes I'll try reaching out to the editors of RFC6570 so that they can shed some light on this. |
I reached out to one of the editors of RFC6570, and the problem is that the dollar sign is defined as reserved for future use (e.g., handling That said, dollar signs are still valid characters in URIs (RFC3986), which means that there should be a way for you to define an "escaped" versions of it on the URI template, and having the template engine interpret them and transform them back into My final thought on this: RFC6570 is flawed unless there is a way for me to define variable names that have Unless if you find a way to do this within the spec, my take is you should treat |
Hey @jmdacruz thanks for the comprehensive research!
We have hit many boundaries there so many times.
Thank for the trust! Now, we cannot fail you! :)
This is possible to do. I am more thinking about following getting rid of URI templates altogether (unless explicitly used). So you could be writing just: # Resource [/r]
- parameters
- $filter (string, query) This could solve the issue for query parameters. Not sure how to get around path segments. Maybe just to use Express JS / Sinatra syntax for path variables: # Resource [/r/:id]
- parameters
- $filter (string, query)
- id (number, path) But I am sure we would run into a new whole world of problems with Thoughts? |
I think your proposal should work. Since the order to query string parameters doesn't really matter, I think it's perfectly fine to have them listed on the "parameters" section. On the path parameters, you obviously need something to indicate where the parameter would be located in the path, and the Note that the difference between query and path parameters is that the former indicates a variable name that will be visible in the final URL (e.g., That said, I also think that the URI template syntax is nice and makes query string parameters more visible in the URL while writing the blueprint (the end result, the documentation and sample code, will be identical in any case) |
I have a similar problem when using an URI template with multiple composite parameters: Something like this ## Resources [/resources{?foo*,bar*}] causes a |
@BreiteSeite you are correct – Note, in Apiary, they the explode modifier is not supported (see https://docs.apiary.io/api_101/uri-templates/#unsupported) |
Defining something like this:
## Resources [/resources{?$filter}]
throws the following error:
But, the use of such parameters is actually quite common in the industry, for instance see: http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html
Moreover, the use of '$' is allowed by the URI specification (see: http://tools.ietf.org/html/rfc3986#section-2). This means that the '$' must not be URL encoded. A similar issue was also addressed by swagger earlier this year: swagger-api/swagger-editor#308
The text was updated successfully, but these errors were encountered: