Skip to content

Json Codecs Directly? #337

Answered by kubukoz
Quafadas asked this question in Q&A
Jul 28, 2022 · 3 comments · 9 replies
Discussion options

You must be logged in to vote

Hi @Quafadas, Smithy4s does indeed create encoders/decoders for the shapes you define in your specs. They're not generated as Scala sources but rather derived at runtime.

You can access an instance of such a decoder/encoder, but you have to be aware of the following:

  • encoding/decoding concerns are protocol-specific, and as such you'll need to pick a protocol when defining your codecs. For @simpleRestJson it's not going to be difficult
  • building an encoder/decoder is computationally expensive, so you're likely to want to keep the result of doing that for as long as possible (ideally, for as long as the application runs)
  • there's no standard typeclass for encoders/decoders as of now
  • if you'r…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@Quafadas
Comment options

Answer selected by Quafadas
Comment options

You must be logged in to vote
4 replies
@Quafadas
Comment options

@Baccata
Comment options

@Quafadas
Comment options

@Baccata
Comment options

Comment options

You must be logged in to vote
4 replies
@Baccata
Comment options

@Quafadas
Comment options

@Baccata
Comment options

@Quafadas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants