jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
56 stars 58 forks source link

Fix uri resolution #208

Closed karenetheridge closed 3 years ago

karenetheridge commented 4 years ago

Summary

There are various cases where uri resolution was not performed correctly with respect to $id and $ref keywords. Many test cases have been added demonstrating things that did not work previously.

Motivation

My application that uses JSON::Validator needs to pre-load and use documents with $refs like /foo/bar/baz#/json/pointer and resolve them against $ids like http://spec.app.corp.com.

References

URI resolution within document traversal is specified at https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.

Thank you Joyent for sponsoring the approximately 3 days of paid work that went into producing and verifying this pull request.

karenetheridge commented 4 years ago

(the force-push I just did was only correcting a typo in the last commit message.)

jhthorsen commented 4 years ago

Could you implement this functionality on top of #211? I think #211 is more aligned with what you need, even though it doesn't fix the issues you have here.

...maybe I should merge #210 before asking to build on top of #211 ;)

karenetheridge commented 4 years ago

No, #210 and #211 change a lot more things, and will undo the fixes that I am making here (and make it a lot harder to fix them again on top). If you merge #208 first you will see the issues with your refactoring.

jhthorsen commented 3 years ago

I think this PR is now outdated after adding JSON::Validator::Store.