About this project
gRPC-Gateway is a plugin for the Google protocol buffers compiler (protoc). It reads protobuf service definitions and generates a reverse-proxy server that translates a RESTful HTTP API into gRPC, based on google.api.http annotations in the service definitions. This allows a service to be exposed in both gRPC and RESTful JSON styles at the same time.
Key capabilities described in the README:
- Generates JSON API handlers and a reverse proxy from proto definitions.
- Supports method parameters in the request body, path, and query string.
- Handles enum fields in path parameters, including repeated enum fields.
- Maps streaming APIs to newline-delimited JSON.
- Three mapping approaches: default HTTP mapping (with generate_unbound_methods), custom google.api.http annotations, or an external gRPC Service Configuration file (optionally with standalone=true).
- Optional OpenAPI/Swagger generation via protoc-gen-openapiv2, and an alpha protoc-gen-openapiv3 for OpenAPI 3.1 output.
- Installation via go install, Go 1.24 tool directives, or prebuilt release binaries with SLSA3 signatures.
- Usage with buf (local or remote plugins) or protoc, with example buf.gen.yaml configurations.
- A runtime library (runtime.NewServeMux) for writing the HTTP entrypoint that proxies to a gRPC server endpoint.
- Documentation site, examples directory, and a GopherCon UK 2019 video intro.
The README notes that protoc-gen-openapiv3 is alpha and its output shape may change, while protoc-gen-openapiv2 is the production-stable option. It also mentions path-parameter renaming for duplicate mappings and unescaping modes for URL-encoded slashes.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.