zio-http
zio-http copied to clipboard
Implement a code generator that takes Smithy spec and generates zio.http.api.EndpointSpec values
Is your feature request related to a problem? Please describe.
Some companies begin with Smithy specifications, and then proceed to implement a server that satisfies a given Smithy specification; then they will modify the Smithy 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 a Smithy specification, and generate the corresponding zio.http.api.EndpointSpec values that declaratively describe the APIs.
Then a user can implement handlers based on the code-generated EndpointSpec values.
Possibly, this could be done as a plug-in to smithy4s.
/bounty $500
💎 $500 bounty • ZIO
Steps to solve:
- Start working: Comment
/attempt #1522with your implementation plan - Submit work: Create a pull request including
/claim #1522in the PR body to claim the bounty - Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts
Thank you for contributing to zio/zio-http!
Add a bounty • Share on socials
| Attempt | Started (GMT+0) | Solution |
|---|---|---|
| 🟡 @promisingcoder | Jul 9, 2024, 8:00:50 AM | WIP |
I can take on creating a PR in this repo, to have a zio-http interpreter(Smithy4s terminology). I would wait until Smithy4s 0.18 version is released as it will make it a lot easier. Happy to discuss further
Hi, I was looking into option of using a recursion scheme(s)/fix-point parser for Smithy IDL using its ABNF spec. In particular skeuomorph has an implementation of transforming protobuf schemas. If a similar approach can be used for the parser and also leveraging smithy4s for the spec. implementation.
@saadhashmi91 We would like to do this without any third party dependencies.
@adamgfraser just to be clear, do you allow other ZIO Organization dependencies, like zio-schema?
@sideeffffect If that functionality is necessary for something we are trying to do. For example ZIO Schema is already a dependency since it is necessary to describe arbitrary types as values as part of the endpoints API and we would basically have to implement it ourselves otherwise. But in general would not want to bring in an additional dependency if it was merely a "nice to have".
Hi, I was looking into option of using a recursion scheme(s)/fix-point parser for Smithy IDL using its ABNF spec. In particular skeuomorph has an implementation of transforming protobuf schemas. If a similar approach can be used for the parser and also leveraging smithy4s for the spec. implementation.
What would be the point of implementing a parser if you are trying to leverage smithy4s codegen? Also Smithy already has a parser and AST to represent it. I would recommend using that
@yisraelU Cool, I didn't look into it in detail.
@yisraelU I know you did some work on a smithy interpreter for zio-http - but were waiting for a new smithy 0.18 release for some extra functionality - did the release happen? were you able to use it? If so then we may be in a position to start evaluating soon
@googley42 yes. It was released not too long ago. Unfortunately it is taking a bit longer as I need to refactor for the rc3 version of ziohttp which has quite a few breaking changes
I just wanted to drop a note that I have published https://yisraelu.github.io/smithy4s-zio/
/attempt
@promisingcoder I will implement this ticket or at least find a strategy to do so together with @jdegoes on stream on the 26.07.
In general, this is not an easy task and I think you wrote in discord that you are a Scala beginner. Maybe you should try to pick some smaller issues first to get some experience.
@987Nabil I currently made a parser it is still in the beginning that takes in the smithy file and generates specs for a zio server and the server is running !! it's simple and in the beginning I intend to implement this feature I understand your concern but I intend to carry on
@promisingcoder: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏