Skip to content
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

Support for multi-segment elements #122

Closed
bluecmd opened this issue Mar 2, 2016 · 4 comments
Closed

Support for multi-segment elements #122

bluecmd opened this issue Mar 2, 2016 · 4 comments
Labels

Comments

@bluecmd
Copy link

bluecmd commented Mar 2, 2016

Hi,

I interpret https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L191 as it should be OK to for example write:

        rpc Lookup(IdMessage) returns (ABitOfEverything) {
                option (google.api.http) = {
                       get: "/v1/example/a_bit_of_everything/{uuid=**}"
                };
        }

.. and in this case make the the URL http://localhost:8080/v1/example/a_bit_of_everything/foo/bar valid (uuid would then become "foo/bar").

Changing to {uuid=*} and comparing the generated protobuf code with just {uuid} results in no diff, excellent! Changing to {uuid=**} provides this diff:

-       pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, ""))
+       pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 3, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, ""))

Which seems to be replacing a OpPush with OpPushM which seems exactly what we want.

Recompiling the example, adding debug output to the gRPC backend server, and trying to access the webpage gives:

http://localhost:8080/v1/example/a_bit_of_everything/foo
{"error":"foo not found","code":5}

but

http://localhost:8080/v1/example/a_bit_of_everything/foo/bar
Not Found

What gives?

@yugui yugui added the bug label Mar 3, 2016
@kazegusuri
Copy link
Contributor

This issue is variable cannot be captured from multiple path components when using {uuid=**}, right?
I tried and it worked correctly with changing examples to {uuid=**} and small server change about uuid generation. something misunderstanding?

$ curl -d @body.json -H 'Content-Type: application/json' localhost:8080/v1/example/a_bit_of_everything
{"uuid":"foo/1fb1b956a11ac231deb7270b9f792db201f4c4a1797ff2b1","nested":[{"name":"bar","amount":10},{"name":"baz","amount":20}],"float_value":1.5,"double_value":2.5,"int64_value":4294967296,"uint64_value":9223372036854775807,"int32_value":-2147483648,"fixed64_value":9223372036854775807,"fixed32_value":4294967295,"bool_value":true,"string_value":"strprefix/foo","uint32_value":4294967295,"sfixed32_value":2147483647,"sfixed64_value":-4611686018427387904,"sint32_value":2147483647,"sint64_value":4611686018427387903}
$ curl localhost:8080/v1/example/a_bit_of_everything/foo/1fb1b956a11ac231deb7270b9f792db201f4c4a1797ff2b1
{"uuid":"foo/1fb1b956a11ac231deb7270b9f792db201f4c4a1797ff2b1","nested":[{"name":"bar","amount":10},{"name":"baz","amount":20}],"float_value":1.5,"double_value":2.5,"int64_value":4294967296,"uint64_value":9223372036854775807,"int32_value":-2147483648,"fixed64_value":9223372036854775807,"fixed32_value":4294967295,"bool_value":true,"string_value":"strprefix/foo","uint32_value":4294967295,"sfixed32_value":2147483647,"sfixed64_value":-4611686018427387904,"sint32_value":2147483647,"sint64_value":4611686018427387903}
$ curl localhost:8080/v1/example/a_bit_of_everything/foo
{"error":"not found","code":5}

@bluecmd
Copy link
Author

bluecmd commented Apr 10, 2016

Odd. That looks exactly what I tried and couldn't get to work. I'll see if I can reproduce it from current master.

@achew22
Copy link
Collaborator

achew22 commented Jan 4, 2017

@bluecmd, did you ever have any luck reproducing it from master? I'm doing a little bit of tidying so I'm going to close this but feel free to reopen this issue if you have more information.

@achew22 achew22 closed this as completed Jan 4, 2017
@bluecmd
Copy link
Author

bluecmd commented Jan 4, 2017

I don't remember TBH, I'll reopen if I run into this again in the future!

@tamalsaha tamalsaha mentioned this issue Mar 30, 2017
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants