WIP: Add grpc-gateway support
Related to https://gitlab.com/gitlab-org/gitaly/issues/191
Experimenting in adding grpc-gateway
, Swagger and auto-generated Ruby client support to gitaly-proto
Merge request reports
Activity
Very impressive. So if I understand correctly, the changes in this MR are:
- run extra code generation plugin when building libs from .proto
- some of these code generator plugins use Java -> would be a development dependency for gitaly-proto only, not runtime, no Java needed for gitaly server / clients
- we would have to annotate each RPC to indicate what it's REST endpoint would be
run extra code generation plugin when building libs from .proto
There are two new
protoc
generators- a Go grpc Gateway generator (
gateway/*.pb.gw.go
), which generates the JSON to gRPC go server logic - a Swagger generator, (
swagger/*.swagger.json
), which generators a Swagger definition of the JSON gateway
Once we have the Swagger generator, we're able to generator a native Ruby client (or client for any other major language, for that matter). In order to do this, we run
swagger-codegen generate
. Unfortunately, the Swagger generator is written in Java, so we have a build time dependency on Java.we would have to annotate each RPC to indicate what it's REST endpoint would be
Yes, although this this is a fairly trivial thing to do. I did this for all the existing endpoints in a matter of minutes.
- a Go grpc Gateway generator (