Implement a code generator that takes protobufs and generates zio.http.api.EndpointSpec values
Is your feature request related to a problem? Please describe.
Some companies begin with protobufs for gRPC, and then proceed to implement a server that satisfies the protobuf specification; then they will modify the protobuf specification when a change is necessary, and then re-implement the server.
Describe the solution you'd like
In order to support this spec-first driven approach to API development (rather than code-first, which is the paradigm already implemented within the zio.http.api package), we will need a code generator, which can read in protobuf specification, and generate the corresponding zio.http.EndpointSpec values that declaratively describe the APIs.
Each gRPC service definition should translate into a single EndpointSpec definition.
Then a user can implement handlers based on the code-generated EndpointSpec values.
@jdegoes @adamgfraser Is this not what zio-grpc is doing, just adjusted to the new API design? Should this be added to zio-http? Or should this live in zio-grpc? If it would be added to zio-http, would we use scalapb to parse the messages need for the service? Or would we just create an interface/trait for the messages? I think messages to case classes makes more sense.
I think we generate both the EndpointSpec and the case classes from the protobufs, and use ZIO Schema to do the encoding / decoding.
This would be great to add. Is anyone working in this?
@dejvid I don't think so. I am focusing on OpenAPI currently and that is also planned for the 3.0 release afaik. I might work on protobuf afterwards, but maybe this would not be part of the next release. If you like to work on it, feel free ofc ;)
/bounty $650
~~## 💎 $650 bounty • ZIO~~
~~### Steps to solve:~~
~~1. Start working: Comment /attempt #1521 with your implementation plan~~
~~2. Submit work: Create a pull request including /claim #1521 in the PR body to claim the bounty~~
~~3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts~~
~~### Additional opportunities:~~
~~- 🔴 Livestream on Algora TV while solving this bounty & earn $200 upon merge! Comment /livestream once live~~
~~Thank you for contributing to zio/zio-http!~~
~~Add a bounty • Share on socials~~
| Attempt | Started (GMT+0) | Solution |
|---|---|---|
| 🔴 @pablf | Mar 15, 2024, 8:48:01 PM | #2814 |
I will work on it.
@jdegoes What's the current status of this issue?
@digital-phoenix Looks like someone was working on it but that was quite a while ago so if you are interested you should feel free to pick it up.
/attempt #1521
| Algora profile | Completed bounties | Tech | Active attempts | Options |
|---|---|---|---|---|
| @pablf | 23 ZIO bounties | Scala, Rust |
Cancel attempt |
@pablf: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏
The bounty is up for grabs! Everyone is welcome to /attempt #1521 🙌
💡 @pablf submitted a pull request that claims the bounty. You can visit your bounty board to reward.