grpc-json: add inline descriptor support (#309)

Signed-off-by: Lizan Zhou <zlizan@google.com>
pull/336/head
Lizan Zhou 7 years ago committed by Matt Klein
parent 1d80e460f9
commit ca8355a6d1
  1. 35
      api/filter/http/transcoder.proto
  2. 24
      docs/root/api-v1/http_filters/grpc_json_transcoder_filter.rst
  3. 25
      docs/root/configuration/http_filters/grpc_json_transcoder_filter.rst

@ -8,28 +8,19 @@ import "validate/validate.proto";
// gRPC-JSON transcoder :ref:`configuration overview <config_http_filters_grpc_json_transcoder>`.
message GrpcJsonTranscoder {
// Supplies the binary protobuf descriptor set for the gRPC services.
// The descriptor set has to include all of the types that are used in the services. Make sure
// to use the ``--include_import`` option for ``protoc``.
//
// To generate a protobuf descriptor set for the gRPC service, you'll also need to clone the
// googleapis repository from Github before running protoc, as you'll need annotations.proto
// in your include path.
//
// .. code-block:: bash
//
// git clone https://github.com/googleapis/googleapis
// GOOGLEAPIS_DIR=<your-local-googleapis-folder>
//
// Then run protoc to generate the descriptor set from bookstore.proto:
//
// .. code-block:: bash
//
// protoc -I$(GOOGLEAPIS_DIR) -I. --include_imports --include_source_info \
// --descriptor_set_out=proto.pb test/proto/bookstore.proto
//
// If you have more than one proto source files, you can pass all of them in one command.
string proto_descriptor = 1 [(validate.rules).string.min_bytes = 1];
oneof descriptor_set {
option (validate.required) = true;
// Supplies the filename of
// :ref:`the proto descriptor set <config_grpc_json_generate_proto_descriptor_set>` for the gRPC
// services.
string proto_descriptor = 1;
// Supplies the binary content of
// :ref:`the proto descriptor set <config_grpc_json_generate_proto_descriptor_set>` for the gRPC
// services.
bytes proto_descriptor_bin = 4;
}
// A list of strings that supplies the service names that the
// transcoder will translate. If the service name doesn't exist in ``proto_descriptor``, Envoy

@ -28,27 +28,9 @@ services to be transcoded.
}
proto_descriptor
*(required, string)* Supplies the binary protobuf descriptor set for the gRPC services.
The descriptor set has to include all of the types that are used in the services. Make sure
to use the ``--include_import`` option for ``protoc``.
To generate a protobuf descriptor set for the gRPC service, you'll also need to clone the
googleapis repository from Github before running protoc, as you'll need annotations.proto
in your include path.
.. code-block:: bash
git clone https://github.com/googleapis/googleapis
GOOGLEAPIS_DIR=<your-local-googleapis-folder>
Then run protoc to generate the descriptor set from bookstore.proto:
.. code-block:: bash
protoc -I$(GOOGLEAPIS_DIR) -I. --include_imports --include_source_info \
--descriptor_set_out=proto.pb test/proto/bookstore.proto
If you have more than one proto source files, you can pass all of them in one command.
*(required, string)* Supplies the filename of
:ref:`the proto descriptor set <config_grpc_json_generate_proto_descriptor_set>` for the gRPC
services.
services
*(required, array)* A list of strings that supplies the service names that the

@ -10,3 +10,28 @@ gRPC-JSON transcoder filter
This is a filter which allows a RESTful JSON API client to send requests to Envoy over HTTP
and get proxied to a gRPC service. The HTTP mapping for the gRPC service has to be defined by
`custom options <https://cloud.google.com/service-management/reference/rpc/google.api#http>`_.
.. _config_grpc_json_generate_proto_descriptor_set:
How to generate proto descriptor set
------------------------------------
Envoy has to know the proto descriptor of your gRPC service in order to do the transcoding.
To generate a protobuf descriptor set for the gRPC service, you'll also need to clone the
googleapis repository from GitHub before running protoc, as you'll need annotations.proto
in your include path, to define the HTTP mapping.
.. code-block:: bash
git clone https://github.com/googleapis/googleapis
GOOGLEAPIS_DIR=<your-local-googleapis-folder>
Then run protoc to generate the descriptor set from bookstore.proto:
.. code-block:: bash
protoc -I$(GOOGLEAPIS_DIR) -I. --include_imports --include_source_info \
--descriptor_set_out=proto.pb test/proto/bookstore.proto
If you have more than one proto source files, you can pass all of them in one command.

Loading…
Cancel
Save