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

google.api.http option not picked up/mapped correctly? #1148

Closed
catper opened this issue Mar 3, 2020 · 4 comments
Closed

google.api.http option not picked up/mapped correctly? #1148

catper opened this issue Mar 3, 2020 · 4 comments

Comments

@catper
Copy link

catper commented Mar 3, 2020

The proxy doesn't generate HTTP bindings as expected when using an annotation like this:

    rpc GetAccount (GetAccountReq) returns (Account) {
        option (google.api.http) = {
            get: "/v1/{name=accounts/*}"
        };
    }

According to the first example in Google's http.proto this should map to

GET /v1/accounts/123456

with 123456 being assigned to the name field of Account. However, attempting to curl the above results in a 404 being returned.

I notice that the version of http.proto that is included in grpc-gateway is different from the one I linked above and that it doesn't contain any annotations of this type. I also don't see any occurence of this type of annotation anywhere in the examples.

The question thus is if grpc-gateway supports this annotation or not? If not, are there any plans to include support for it? If this is supported, is there some special magic I need to apply to expose the binding?

@johanbrandhorst
Copy link
Collaborator

Hi, thanks for the issue report.

To be clear, I think the first example says that the value accounts/123456 should be set to the field name of Account, correct?

We are talking about this line, right? https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L88.

As for the gateways handling of this, I would definitely expect this to work. Do you have a minimally reproducible example that shows this not working?

@catper
Copy link
Author

catper commented Mar 3, 2020

To be clear, I think the first example says that the value accounts/123456 should be set to the field name of Account, correct?

Correct, sorry for being unclear.

Will be back with a mini example.

@catper
Copy link
Author

catper commented Mar 3, 2020

turns out this is just me getting my wires crossed vis a vis which ports lead where. am now quietly going to recede into a corner in shame.

kudos on the super quick feedback though, that's impressive!

@catper catper closed this as completed Mar 3, 2020
@johanbrandhorst
Copy link
Collaborator

Glad it worked out, and thanks for using the project! Join the #grpc-gateway channel on the Gophers slack for even quicker feedback next time 😄.

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

No branches or pull requests

2 participants