Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Error Reporting #22

Open
bwestergard opened this issue Jun 6, 2018 · 2 comments
Open

Document Error Reporting #22

bwestergard opened this issue Jun 6, 2018 · 2 comments

Comments

@bwestergard
Copy link

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?

@johnwright
Copy link
Member

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!

@bwestergard
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants