Open jgall opened 4 years ago
Two main things that are somewhat blockers for this:
prost
and exposed generically within tonic.I think trying to get the prost support would be a good first step!
I suggest that google grpc http transcoding annotations be used here to maintain a standard between frameworks and tools https://cloud.google.com/endpoints/docs/grpc/transcoding
Is there any update on this? It would be a fantastic feature to add.
I've been trying to figure out how to do this (as a consumer of tonic, not by cracking it open), and have come across a few articles that make it seem like it should work, but I haven't had much luck. I've been able to compile it with annotations, but issuing HTTP requests to the alleged REST endpoints oddly returns status 200 OK, but with no content, and the GRPC endpoint handler isn't being called.
Links:
I believe the first step is to add support for this in prost. I want to say https://github.com/tokio-rs/prost/issues/301 this is the closet issue to what you may want.
I assume that no more progress has been made on this, correct?
Correct, we have not made much progress on the prost
side of things.
Feature Request
Motivation
A frequent use-case on top of gRPC is to expose a REST API built to mirror the RPC defined in your proto file. The grpc-gateway plugin for protoc does just that, automatically. I think it would be great if we could optionally support these same annotations (perhaps behind a feature flag or in a different crate?).
Proposal
Functional drawbacks:
Alternatives
One could conceivably write an entirely different crate that wraps Tonic and pre-processes the grpc-gateway annotations to create a REST API and some stubs that the user could hook in to their Tonic trait impls.