Replies: 1 comment 4 replies
-
frankly, as much as I like both tapir and smithy4s, I don't think it's a good combination ;) they solve a similar problem in fundamentally opposite ways (code-first vs contract-first). (although worth mentioning, there's an experiment in progress by @Baccata to provide a code-first approach too). Going through the effort of converting from Smithy4s's abstract representation (Schema) to another abstract representation (Endpoint) sounds counter-productive and I think it'd be much better to just pick one. I don't know what the API of tapir's Some things you can look at for inspiration:
All in all, I think it would be in your (and the company's) best interest to revisit the decision to use both. If you already have a Smithy spec, use smithy4s. If you already have Tapir endpoints, use Tapir. Using both will land you in the position of having to implement not only your business logic and smithy definitions, but also the complex, costly and pretty low-level conversions - that can't possibly be a good use of time. |
Beta Was this translation helpful? Give feedback.
-
I'm in the funny situation where I have a smithy definition to implement but the company wants the services to be implemented in tapir. Now, smithy4s generates me the code for the service and I have an impl for it, but whereas normally you'd then feed this to
SimpleRestJsonBuilder
I now have to instead pass on the impl to tapir'sEndpoint
s.So i have:
Now in order to have this, I'd need:
given a
smithy4s.Schema
forA
is there a way to derive circe Codecs for it? had a look at theSimpleRestJsonBuilder
to get an idea of how it's done but there were so many nested layers of nesting and abstractions that I gave up, but I feel like this bit should be the easy bit.How about
sttp.tapir.{Codec, Schema}
? 🤔Beta Was this translation helpful? Give feedback.
All reactions