Open fanf opened 2 years ago
Thanks for the minimization, @fanf. I can confirm that something’ going on here and I’m working on it.
@fanf It looks to me that JsonCodec
derivation isn’t considering JsonDecoders inside of other codecs when recursively deriving JsonDecoders
.
The most minimal workaround is to also a JsonDecoder
for each derived JsonCodec
.
In line :29
of your example
implicit lazy val eitherListOrValueDecoder: JsonDecoder[Either[List[String], JsonExpectedValueId7_1]] =
codecJsonEitherValue.decoder
I’m not yet sure about how to fix this properly. Let me know if this workaround ↑ helps you.
I will try, thanks. What is suprising is that it used to work in ZIO 1.0
@fsvehla sorry for the delay, I was finally able to test your workaround and I can confirm that always using a pair of encode, decoder
in place of a codec
leads to the previous correct result.
It's boilterplaty (well, two times more than previous boilerplate) but I least I can go on.
Thanks for the update.
When trying to test upgrade to ZIO 2.0, I discovered that a codec that was correctly decoding JSON with
zio-json 2.0.0-M3
is now failing with3.0.0-RC7
. Even weirder, the decoding starts to work if I remove the encoder from the codec (and only keeps the decoder).A minimization of the problem is available here: https://gist.github.com/fanf/8e77ffcb6af1be02670338254356135d