I have a very simple gRPC Service defined as:
syntax = "proto3";
package helloworld;
import "annotations.proto";
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello(HelloRequest) returns (HelloReply) {
option (google.api.http) = {
post: "/api/v1/hello"
body: "*"
}
}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
The interesting aspect is that I'm using the Envoy gRPC <> JSON transcoding filter to "translate" between HTTP2/Protobuf <> HTTP1/JSON. See https://www.envoyproxy.io/docs/envoy/latest/api-v1/http_filters/grpc_json_transcoder_filter for more details.
Further, I'm using Bazel to build the Java based gRPC Services. The Envoy transcoding filter requires some annotations:
option (google.api.http) = {
post: "/api/v1/hello"
body: "*"
}
I'm using the proto_library (https://github.com/cgrushko/proto_library) to generate the corresponding .java files from the .proto definitions, but I'm not able to add the
import "google/api/annotations.proto";
to the .proto files, as I have no idea how to import https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto to a bazel project.
Thank you.
Best Regards, jj
google/api/annotations.proto(and not"annotations.proto") at the top of your file? - user1071136