Open dvgica opened 7 months ago
It appears that this issue also applies to Encoder
and SchemaFor
.
I have worked around it for now by defining my own implicits:
import com.sksamuel.avro4s.Decoder
import com.sksamuel.avro4s.Encoder
import com.sksamuel.avro4s.SchemaFor
import com.sksamuel.avro4s.decoders.StringDecoder
import com.sksamuel.avro4s.encoders.StringEncoder
import com.sksamuel.avro4s.schemas.JavaStringSchemaFor
implicit val thingDecoder: Decoder[Thing] = StringDecoder.map(Thing(_))
implicit val thingEncoder: Encoder[Thing] = StringEncoder.contramap(_.value)
implicit val thingSchemaFor: SchemaFor[Thing] = JavaStringSchemaFor.forType[Thing]
I'm upgrading some 2.13 code to 3.3.1. It makes use of value classes which Avro4s was previously able to derive a
Decoder
for, but in Scala 3 cannot.In short, I think this should work with Avro4s 5.0.8, but does not (Scastie):
gives
In Avro4s 4.1.1 it works fine.
Am I missing something here?