Multiple errors for records?#4
Conversation
|
I gave this some thought but nothing easy is springing to mind. Assuming the I did try figuring out a more "parallel" formulation for object/prop codecs when putting this version of the library together, but I couldn't come up with anything that worked out. I even tried dropping the |
|
Something that I think is related is how the paths in a nested record error are appended. I printed one of the failures from Spago: {
"causes": [
{
"causes": [
{
"causes": [],
"message": "No value found",
"path": "$.package.publish.license"
}
],
"message": "Could not decode PublishConfig",
"path": "$.package.publish.license"
}
],
"message": "Could not decode PackageConfig",
"path": "$.package.publish.license"
}It's strange to me that the {
"causes": [
{
"causes": [
{
"causes": [],
"message": "No value found",
"path": "$.package.publish.license"
}
],
"message": "Could not decode PublishConfig",
"path": "$.package.publish"
}
],
"message": "Could not decode PackageConfig",
"path": "$.package"
}I couldn't find a way to change |
This PR is not for merging - I am working on purescript/spago#1090, and noticed that since we have a list of errors when decoding, it feels like records should parse "in parallel", i.e. the code should try to parse all the keys and accumulate errors.
It currently doesn't, and bails out as soon as something errors (as demonstrated by the test, which should complain about
nandm), and I guess this is a consequence of defining record sequentially withrecordProp- @garyb do you see any way we could get multiple errors when decoding records?