title: gRPC + Bazel + Envoy Json Proxy - How to import google/api/annotations.proto
body: <p>I have a very simple gRPC Service defined as: </p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>The interesting aspect is that I'm using the Envoy gRPC &lt;> JSON transcoding filter to "translate" between HTTP2/Protobuf &lt;> HTTP1/JSON. See <a href="https://www.envoyproxy.io/docs/envoy/latest/api-v1/http_filters/grpc_json_transcoder_filter" rel="nofollow noreferrer">https://www.envoyproxy.io/docs/envoy/latest/api-v1/http_filters/grpc_json_transcoder_filter</a> for more details. </p>
  
  <p>Further, I'm using Bazel to build the Java based gRPC Services. The Envoy transcoding filter requires some annotations: </p>
  
  <pre><code>option (google.api.http) = {
    post: "/api/v1/hello"
    body: "*"
  }
  </code></pre>
  
  <p>I'm using the proto_library (<a href="https://github.com/cgrushko/proto_library" rel="nofollow noreferrer">https://github.com/cgrushko/proto_library</a>) to generate the corresponding .java files from the .proto definitions, but I'm not able to add the </p>
  
  <pre><code>import "google/api/annotations.proto";
  </code></pre>
  
  <p>to the .proto files, as I have no idea how to import <a href="https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto" rel="nofollow noreferrer">https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto</a> to a bazel project. </p>
  
  <p>Thank you. </p>
  
  <p>Best Regards, 
  jj</p>