Closed mlms13 closed 10 months ago
jsonString |> optionalField("field", string) |> Result.mapError(ParseError.failureToDebugString)
I would expect the above expression to produce an error to the effect of: "Expected object but found \"string\"". Instead:
Failed to decode object: Field \"field\" had an invalid value: Expected object but found \"string\"
This is wrong. The field "field" didn't have an invalid value... it wasn't there at all because the whole thing is not an object.
"field"
I found this while consolidating tests in the v2 branch, but I'll include the fix in 1.2.
v2
I would expect the above expression to produce an error to the effect of: "Expected object but found \"string\"". Instead:
This is wrong. The field
"field"
didn't have an invalid value... it wasn't there at all because the whole thing is not an object.