-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZIO Schema doesn't differentiate Either[L, R]
from fallback semantics
#584
Comments
/bounty $350 This addition to ZIO Schema would be a true fallback, which will encode properly, and attempt decode left first, followed by right if that fails. Because decoding either side could succeed, this implies that use of such a fallback operator will violate laws for union data that is encoded ambiguously. Bounty for addition of the feature, updating existing codecs, and test suite. |
|
/attempt #584 Options |
💡 @pablf submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
🎉🎈 @pablf has been awarded $350! 🎈🎊 |
ZIO Schema has both support for a member of type
Either[L, R]
viaSchema.either
and for something that appears to be intended for fallback viaSchema.orElseEither
, but the latter just encodes to the same thing as the former. And, when you go to use it, you do not actually get fallback semantics. For example, you cannot use it to decode JSON "[42, "43"]
" to something that can either decode fromLong
orString
.This is demonstrated in this Scastie: https://scastie.scala-lang.org/gnp/078lqgCNRjuNBwvnOPyWFg/10
The text was updated successfully, but these errors were encountered: