You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a derived codec on Scala 2, if one tries to decode an object from a non-object (e.g. a JSON string), the error message points to a "Missing required field", instead of pointing to the wrong type.
This is particularly annoying on objects with optional fields, as it wrongly says that an optional field as required :/
importio.circe._importio.circe.generic.semiauto._caseclassFoo(optionalField: Option[String] =None)
objectFoo {
valcodec:Codec[Foo] = deriveCodec
}
// Decodes to Foo(Node), as expectedFoo.codec.decodeJson(Json.obj())
// Scala 2: DecodingFailure at .optionalField: Missing required field// Scala 3: DecodingFailure at : Got value '""' with wrong type, expecting objectFoo.codec.decodeJson(Json.fromString(""))