Open bwestergard opened 6 years ago
Hi - at the moment, error reporting on decoding is very basic. You get a Result
type with a string value describing the type of error, e.g. Expected boolean
.
The next step would be to add the path to where the error was encountered (maybe with JsonPath notation), e.g. Expected boolean at $.foo.bar[2].baz
.
This change should be reasonably straightforward, it involves threading path information through all decoding functions. Watch this space!
@johnwright Great! I was working on a similar project for Flow-typed javascript and settled on the JSONPointer standard. I think the ideal would be a Result<{message: string, pointer: Array<string | number>}>
. The library could then provide a function to serialize the interal JsonPointer representation (Array<string | number>
) as specified in RFC6901.
I'm an inexperienced OCaml developer. Perhaps I'll try to put together a PR.
First, thanks for all of your hard work on this.
Useful error messages are perhaps the most important feature of any serialization/deserialization framework. What sorts of errors does this library provide?