Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating gateway from runtime-compiled protobuf files #3348

Open
andremarianiello opened this issue Jun 7, 2023 · 5 comments
Open

Comments

@andremarianiello
Copy link

馃殌 Feature

I have a program that compiles protobuf files at runtime, and dynamically registers handlers for the services found in the protos, and uses dynamicpb for the messages. I would like to achieve something similar with a grpc-gateway handler. I want to compile protobuf files on startup, and turn the found gateway options into a grpc-gateway handler/muxer that translates incoming requests to protobufs, passes them to my grpc server, and translates the responses back. All the examples I have seen involve generating code before compiling, but that will not work for my use case.

For reference, I am compiling protos with https://github.com/bufbuild/protocompile and creating my grpc server using https://pkg.go.dev/google.golang.org/grpc#UnknownServiceHandler.

@johanbrandhorst
Copy link
Collaborator

Yeah I don't think this is possible with the grpc-gateway as it exists today. If you want to do this, I'd probably recommend looking to write your own translation layer that can be built dynamically, or look at other tools that do a similar thing to the grpc-gateway. This is squarely outside the scope of this project, at least.

@andremarianiello
Copy link
Author

By "out of scope" do you mean that is not going to be planned, or that even if someone made a PR of sufficient quality it wouldn't get merged?

@johanbrandhorst
Copy link
Collaborator

I meant the former, though I think even a contribution would have to be a whole new package that's almost as good as building it from scratch. If you're interested in contributing this, I will of course happily guide you along.

@andremarianiello
Copy link
Author

Much appreciated. I will have to dig into the internals to determine how amenable the code base is to this addition. If the situation is as you describe, I am assuming it will be quite a bit of work.

@emcfarlane
Copy link
Contributor

@andremarianiello checkout https://github.com/bufbuild/larking for dynamic protobuf support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants