I am trying to use Google Cloud Endpoints to make a gRPC based api that can transcode incoming REST requests. I am following their example code but I can not any documentation on how to properly import and compile with the annotation.proto or the empty.proto.
Thank you!
I didn't understand that this was part of grpc-gateway. By following the docs I ran
protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. *.proto
and compiled successfully.
The empty.proto and annotation.proto are not included by default, so you'll need to bring in a copy. Specifically you can make a copy of them in a directory in your project, or reference them in an existing project (like the Protobuf git repo, for instance).
It is probably a good idea to NOT reference the copy that grpc-ecosystem/grpc-gateway uses, because they may want to move it around in the future.
it may not be a good idea.
you can copy google/api/annotations.proto
and google/api/http.proto
into your local project and import them when run python -m
mkdir -p google/api
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto > google/api/annotations.proto
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto > google/api/http.proto
python -m grpc_tools.protoc google/api/http.proto google/api/annotations.proto -I. --python_out=. --grpc_python_out=. your_proto.proto
refurl: https://cloud.google.com/solutions/exposing-grpc-services-using-cloud-endpoints-pt1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With