-
-
Save danbills/a6fe54d7e89c7e3e232fcab69a6f6fe8 to your computer and use it in GitHub Desktop.
Bug deriving Either decoder using generic.auto in Circe. (Run w/ Ammonite)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import $ivy.`io.circe::circe-core:0.6.1` | |
import $ivy.`io.circe::circe-generic:0.6.1` | |
import $ivy.`io.circe::circe-parser:0.6.1` | |
import io.circe._ | |
import io.circe.syntax._ | |
import io.circe.parser._ | |
import io.circe.generic.auto._ | |
case class Hi(s: Either[Long, String]) | |
case class S(s: String) | |
//Fails | |
assert(decode[Hi]("""{"s":"some"}""").isLeft) | |
//Fails | |
assert(decode[Hi]("""{"s":44}""").isLeft) | |
//works | |
assert(decode[S]("""{"s":"some"}""").isRight) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was able to resolve with