Closed GijsbertvanVliet closed 1 year ago
Check the Mappings docs. I don't think there is a such thing in Mappings as Option of Either. Union of 3 types is rather a Shapeless or a Sealed Trait of Classes.
Ok fair enough.
But would you agree that the avro type UNION<null,A,B>
could correspond to scala type Option[Either[A,B]]
and similarly UNION<null,A,B,C>
could correspond to Option[A :+: B :+: C :+: CNil]
?
If yes, then I could try to create a PR to support these build in type mappings.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is an issue regarding the scala3 version of avro4s, but I don't seem to be able to add the required label to this issue for some reason. I'm trying to decode an avro event which has a field of type:
In scala terms this would adheres to data type
Option[Either[String, Int]]
. Unfortunately theOptionDecoder
does not support this type since it requires the number of types in the union schema to be equal to 2. The OptionDecoder does get anEitherDecoder
in its constructor argument though, so in theory it should be able to decode the either if it's given I think.