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

Improve errors reported by JsonSchema decoders #445

Open
julienrf opened this issue Dec 20, 2019 · 2 comments
Open

Improve errors reported by JsonSchema decoders #445

julienrf opened this issue Dec 20, 2019 · 2 comments

Comments

@julienrf
Copy link
Member

Currently, error reported by JsonSchema decoders don’t give much context information (like a full “JSON-path”).

@julienrf julienrf added this to the 1.0.0 milestone Dec 20, 2019
@julienrf julienrf removed this from the 1.0.0 milestone Mar 3, 2020
@harpocrates
Copy link
Collaborator

This seems like a really important thing to have. Did you have an idea or plan for how you think this should be implemented?

Most json encoding libraries I know of (at least circe and spray) track the path to the specific location of the decoding failure in some custom deserialization exception type. Then, the decoder can either pass the path into the structure as it parses (as circe does) or add the path information by catching and re-throw the deserialization exception type (as spray does).

Perhaps Decoder could get a slightly more complex interface (tracking the context) or else Validated could wrap more than just string error messages?

@julienrf
Copy link
Member Author

Did you have an idea or plan for how you think this should be implemented?

As you said, we need to carry more context information when we decode JSON documents. Like this is done with Circe and the history of operations, or Play JSON and the context path.

Perhaps Decoder could get a slightly more complex interface (tracking the context) or else Validated could wrap more than just string error messages?

I believe this would not be necessary but I might be wrong. Enriching Validated with more detailed error messages is also discussed in #446.

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