korzio / djv

Dynamic JSON Schema Validator - Supports draft-04/06
https://www.npmjs.com/package/djv
MIT License
289 stars 31 forks source link

fix: Correct data and schema paths in error handler #93

Closed kkwiatkowski closed 4 years ago

kkwiatkowski commented 4 years ago

Provide an extra error value so that client code have more data to form proper error message

kkwiatkowski commented 4 years ago

Pull request is somehow related to the following issues #54 and #67. I tried to keep the paths as close to the originals as possible aligning these to have almost the same format.

The paths are not fully correct in terms of JSON pointers (according to https://github.com/epoberezkin/ajv#validation-errors) since these are not starting with . nor / and schema path has preceding #.

I can still update it to make the format compatible with AJV.

kkwiatkowski commented 4 years ago

It seems that error handler has more bugs than the above fixes. I'll sniff a bit more and once I'll have more things addressed I'll make a new pull request.