is better error messages for json parsing errors o...
# serialization
c
is better error messages for json parsing errors on the roadmap? it would be cool have a list of problems.
listOf(MissingField("surname"), WrongType("age", was=INT, expected=STRING))
, and also a path to field names when something is missing in a nested object.
c
I guess my main idea is to instead of throwing as soon as one error is detected all errors should be collected and then an exception with a list of errors thrown.
e
the way that decoders are being passed into serializers, there is no way to recover from an error in one object in order to continue and find errors in another
c
ok so this cannot be done in the json lib alone and needs support in core?
e
yeah, I believe this would need some real support in serialization-core
well, I can imagine some hacks possible if you're decoding from a JsonElement, but not streaming
c
this is only for error handling so it does not need to be fast, i can even start the whole parsing from scratch
right now I’m parsing the exception message to get a list of missing fields, but that gives me only the fields of the first object that fails, and no path
e
thinking about this more, there's no way to get all errors without changing how the generated serializers work
c
Can you give an example?