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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support axum-connect code gen #82

Open
6 tasks
AThilenius opened this issue Dec 29, 2023 · 2 comments
Open
6 tasks

Support axum-connect code gen #82

AThilenius opened this issue Dec 29, 2023 · 2 comments

Comments

@AThilenius
Copy link

Hi 👋

I wrote axum-connect, which implements the Connect protocol for use with axum. It's designed to mix proto-based services into existing codebases, happily co-existing alongside more traditional HTTP endpoints. Seeing as you target buf.build I'll digress and assume prior knowledge in this area.

The code generator for axum-connect leaves an awful lot to be desired. It doesn't fit well into polyglot codebases (which is frankly the whole point of axum-connect) nor does it work at all with buf.build. I've had a moonshot item on my list since inception: to support buf.build remote execution for code gen. I just came across your codebase today.

Would you be willing to accept a PR to add support for axum-connect service definitions? I think I can do most (maybe all) the heavy lifting. This would involve:

  • A new directory/workspace-member protoc-gen-axum-connect
    • The code generator is already based on prost
    • There were a lot code-gen hacks I added that need to be done away with
    • Supports any axum-connect specific configuration. None as of right now
    • Determine if we should require protoc-gen-prost (or possibly protoc-gen-prost-crate) as well as protoc-gen-prost-serde. Both are required for axum-connect to make any logical sense. I don't know enough yet to say what the right answer is here; open to suggestions?
  • Publish protoc-gen-axum-connect to buf.build's community plugins for remote code-gen

The code generator itself is very simple, it adds a single function (scoped to a mod) for each proto service RPC. That function is analogous to axum's get and post functions, that wrap a high-order function in a future for use with Axum's extractors. Overall axum-connect is a very simple project, the bulk of the complexity is in the monstrously complicated type definitions for handlers.

@neoeinstein
Copy link
Owner

Hey 👋

I'd definitely be interested in being able to support code generation for axum-connect, particularly as this appears to be within the prost ecosystem of services. I know that I've had discussions before about potentially having tonic extended to support the connect protocol, but I'd be happy to incorporate a generator that would support the service.

Of note, I am a little behind in updating the code generation to support the newest features in the latest versions of prost and tonic (although existing generation hasn't been breaking, which has been nice, and allowed me to delay specific attention there.)

Feel free to submit a PR, and I can work on reaching out to the buf folks to see if they want to accept it in as a remote plugin, assuming all stabilizes well.

@AThilenius
Copy link
Author

Will do! Hopefully I'll have some time coming up soon to get that done. I've chatted with the Buf devs before as well, so I'll be on their radar when you talk to them.

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

2 participants