zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Implement a code generator that takes protobufs and generates zio.http.api.EndpointSpec values

Open jdegoes opened this issue 3 years ago • 10 comments

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 avatar Sep 19 '22 18:09 jdegoes

@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.

987Nabil avatar Oct 27 '22 22:10 987Nabil

I think we generate both the EndpointSpec and the case classes from the protobufs, and use ZIO Schema to do the encoding / decoding.

jdegoes avatar Oct 28 '22 01:10 jdegoes

This would be great to add. Is anyone working in this?

dejvid avatar May 01 '23 10:05 dejvid

@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 ;)

987Nabil avatar May 01 '23 14:05 987Nabil

/bounty $650

jdegoes avatar May 08 '23 15:05 jdegoes

~~## 💎 $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 bountyShare on socials~~

Attempt Started (GMT+0) Solution
🔴 @pablf Mar 15, 2024, 8:48:01 PM #2814

algora-pbc[bot] avatar May 08 '23 15:05 algora-pbc[bot]

I will work on it.

gstrainovic avatar Jun 16 '23 15:06 gstrainovic

@jdegoes What's the current status of this issue?

digital-phoenix avatar Oct 03 '23 19:10 digital-phoenix

@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.

adamgfraser avatar Oct 03 '23 20:10 adamgfraser

/attempt #1521

Algora profile Completed bounties Tech Active attempts Options
@pablf 23 ZIO bounties
Scala, Rust
Cancel attempt

pablf avatar Mar 15 '24 20:03 pablf

@pablf: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

algora-pbc[bot] avatar Mar 22 '24 20:03 algora-pbc[bot]

The bounty is up for grabs! Everyone is welcome to /attempt #1521 🙌

algora-pbc[bot] avatar Mar 29 '24 20:03 algora-pbc[bot]

💡 @pablf submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar May 12 '24 18:05 algora-pbc[bot]

🎉🎈 @pablf has been awarded $650! 🎈🎊

algora-pbc[bot] avatar May 13 '24 11:05 algora-pbc[bot]