-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Values containing slashes in URL template? #23
Comments
I just realized (thanks @sqs) that I missed a very important bit:
So it is possible. |
Confirmed that it works. It's possible to achieve the above by doing:
|
@shurcooL Do I understand your findings here correctly?
Would match only a single path element (but it could be a URI encoded path). Whereas:
Would match multiple path elements (that are not URI encoded)? |
@slimsag Yes, the above is correct.
I don't think so. This is a url path element, not a query parameter. Edit: I could be mistaken, see e.g., golang/go#5777 (comment). However, I'm reopening this because I find that it only works if such segment is at the end of the route. It doesn't seem to work when it's in the middle. For example, this works:
But this does not work:
Is that a bug? |
@shurcooL Your question is whether the multi-segment wildcard |
That is true. I agree that the spec doesn't seem to specify one way or the other. Thanks for looking into it. |
Tail length means the length of fixed-size segements after a deep wildcard in the pattern. This helps us to care of #23 on pattern matching.
Tail length means the length of fixed-size segements after a deep wildcard in the pattern. This helps us to care of #23 on pattern matching.
Thank you for resolving this! |
6ced950 Merge pull request #23 from tronprotocol/tron_proxy 38c1d2e fix install-protobuf.sh aeffcf9 update readme.md 23f0cce change protobuf-java to protobuf-all for protoc 950a9b9 disable travis cache 4743ea0 fix install-protobuf.sh 48a994c fix go gen script 21fba07 add protoc-go-gen dependencies d536dda rm cached directory 84e3f19 add protoc-gen-go plugin 8ead80e add go proto ci 623ceea fix install-googleapis 65314a5 add googleapis proto file into protoc include b33bfdd config http url for grpc 7210154 add swagger generate srcipt and swagger definitions 169058a add tron grpc proxy git-subtree-dir: protocol git-subtree-split: 6ced950
From reading https://github.com/google/googleapis/blob/master/google/api/http.proto, it suggests that some parameters may be a part of the URL template, for example:
However, if I'm reading this spec right, those values may not contain slashes, can they?
For example, suppose I wanted to define:
And have the following HTTP requests match:
Only the first will get matched, the other two will not. Is that so?
Is it true that there's no way to have all 3 of the above paths get matched, as long as grpc-gateway follows that
google.api.http
spec? Is the only alternative to use URL queries, likeGET /v1/dirs?dir_path=foo/bar/baz
?If so, that seems to put a heavy restriction on one's ability to create RESTful APIs using
grpc-gateway
, since it's often desirable to have some slash separated paths as values.The text was updated successfully, but these errors were encountered: