google.api.Http
annotation support
#277
-
Describe the solution you'd like It would be great if connect supported some subset of
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
We have part of the solution to this already, and the remainder is on our roadmap:
|
Beta Was this translation helpful? Give feedback.
-
As outlined in issue #313 I opened before being guided to this one I would appreciate support for configurable REST calls defined in the proto files as well. As I was asked to explain why I think this makes sense I would like to share my points with you. Many users prefer REST over gRPC. Even though I really like gRPC many others still prefer REST over gRPC since it's easier and quicker to apply in some fields. I realised that it is not possible to enforce gRPC-APIs in any environment due to technical obstacles or simply some people's preferences. A co-existence of REST and gRPC would be a good solution to the problem in my opinion. POST-only HTTP endpoints are not really what a REST API consumer would expect. It works and it does its job if I want to debug an API with curl for example. However, in usual REST-APIs there are more individual requirements when it comes to the path and the HTTP method. Consequently, this should be configurable. This does not necessarily need to replace the connect protocol's HTTP POST endpoint if configured but can alternatively be configured to co-exist (the default connect protocol endpoint and optionally the REST endpoint if defined in the proto file). The existence of the connect protocol's endpoint would still be valid. An option that can be passed to the protoc plugin that decides if the connect protocol and the configured REST endpoint should co-exist or if configured REST endpoints should replace the connect endpoints would be a potential solution. I'd really appreciate to read your opinion. Thanks! |
Beta Was this translation helpful? Give feedback.
-
There is already grpc-gateway. |
Beta Was this translation helpful? Give feedback.
-
I found this project, hope it helps you https://github.com/johanbrandhorst/connect-gateway-example |
Beta Was this translation helpful? Give feedback.
-
Hello everyone ! We may have done what you're looking for, which is something to easily bind Connect handlers to the Google API HTTP request specifications defined with your services' RPCs. To do this, we wrote a very simple code generator to produce all the boilerplate needed to bind local gRPC Gateway handlers with Connect handlers. No network communication, no request re-encoding, just simple function calls like so: Pros:
Cons:
Here is the link to our repository: https://github.com/vallahaye/connect-gateway @bufdev I've seen this feature requested many times in the past. If you're satisfied with our implementation, feel free to link our repository next time someone asks for "Google API HTTP annotations support" 😉 |
Beta Was this translation helpful? Give feedback.
-
I have a project that wraps gRPC servers with HTTP annotations called larking. It works wrapping the expected I was hoping to start a port to connect-go. My library would greatly benefit removing the gRPC server stack as it already uses the (experimental) gRPC ServeHTTP option for cloud run support. For the implementation I'd currently need to take the string response from the connect generated: // svc == /service.Name/` and ss is the connect implementation
func (m *Mux) RegisterConnectService(svc string, ss any) {} Which could lookup the service descriptors, then with reflection access the server implementation. It would be nice for the generated code to describe the mapping like |
Beta Was this translation helpful? Give feedback.
-
Vanguard has just been released! It implements RPC & REST protocol transcoding as a simple http handler and supports connect out of the box. See the docs for creating a REST to RPC transcoder. |
Beta Was this translation helpful? Give feedback.
Vanguard has just been released! It implements RPC & REST protocol transcoding as a simple http handler and supports connect out of the box. See the docs for creating a REST to RPC transcoder.