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
Validation error reports invalid path (one segment missing) for missing required field validation error.
See code below to compare how it looks like for invalid field type vs missing field.
sealedtraitAcaseclassAA(a: Int) extendsAcaseclassX(a1: AA, a2: A)
implicitvalaaCodec:Codec[AA] = io.circe.generic.semiauto.deriveCodec
implicitvalaCodec:Codec[A] = io.circe.generic.semiauto.deriveCodec
implicitvalxCodec:Codec[X] = io.circe.generic.semiauto.deriveCodec
println(X(AA(1), AA(2)).asJson.noSpaces) //{"a1":{"a":1},"a2":{"AA":{"a":2}}}// similar input; in first `a1.a` has invalid type, in second `a1.a` is missingvalinput1=json"""{"a1":{"a":true},"a2":{"AA":{"a":2}}}"""// invalid typevalinput2=json"""{"a1":{},"a2":{"AA":{"a":2}}}"""// missing required field
println(input1.as[X]) // Left(DecodingFailure at .a1.a: Int)
println(input2.as[X]) // Left(DecodingFailure at .a: Missing required field) - path should be as above// same here, just with additional nest levelvalinput3=json"""{"a1":{"a":1},"a2":{"AA":{"a":true}}}"""// invalid typevalinput4=json"""{"a1":{"a":1},"a2":{"AA":{}}}"""// missing required field
println(input3.as[X]) // Left(DecodingFailure at .a2.AA.a: Int)
println(input4.as[X]) // Left(DecodingFailure at .a2.a: Missing required field) - path should be as above
The text was updated successfully, but these errors were encountered:
Validation error reports invalid path (one segment missing) for
missing required field
validation error.See code below to compare how it looks like for
invalid field type
vsmissing field
.The text was updated successfully, but these errors were encountered: