Generate descriptor file with a GRPC configuration file

10 views
Skip to first unread message

rcio wang

unread,
May 24, 2019, 4:44:42 AM5/24/19
to Protocol Buffers
Hi All,

I currently use GRPC as my backend service protocol, and use Envoy Proxy as ingress gateway instead of Nginx.
A descriptor file can be read by Envoy to serve grpc service with http restful api, so i add grpc http annotations to proto defination file, like:

    rpc Foo(Empty) returns (Bar) {
        option (google.api.http).get = "foo";
    };

Problem is when I use this proto file generate golang backend server code, it'll import the  google/annotations package, which is totally needless for grpc service. Annotations only should be compiled when generate descriptor file out, this file will be used by Envoy to serve HTTP APIs.
But I can't find a way to separate them, just a solution with a configuration file, but it only works with google cloud services.

So does anyone once facing same problem? Any help is grateful.

Thank you.

Rcio
Reply all
Reply to author
Forward
0 new messages