stefankoegl / python-json-pointer

Resolve JSON Pointers in Python
https://python-json-pointer.readthedocs.org/
Other
140 stars 43 forks source link

Provide an API for detecting invalid JSON Pointers #20

Closed Julian closed 6 years ago

Julian commented 7 years ago

Hi!

Would you consider an API to validate whether a particular input was valid under RFC 6901 (or does such a thing exist already and I've missed it)?

E.g., /foo/bar~ is not a valid JSON Pointer seemingly (the ~ is not escaped), but I cannot see an API that complains about that -- jsonpointer.JsonPointer will happily accept it as another pointer part.

(Even having jsonpointer.JsonPointer do enough validation of its inputs would also work).

Full context: JSON Schema Draft 6 adds a jsonpointer format. I'd love to use python-json-pointer to implement it in jsonschema.

stefankoegl commented 6 years ago

JsonPointer is already doing some form of input validation (eg it complains if there is no leading /). I've now extended this for the cases you mentioned in #24.

Can you please have a look if this would meet your requirements?

Julian commented 6 years ago

Hey! Thanks, that does work, and passes all the tests. Appreciated!

stefankoegl commented 6 years ago

I've just released version 1.14 with the new validations.

Julian commented 6 years ago

Awesome! Will have a look, thanks so much!

On Oct 30, 2017 15:50, "Stefan Kögl" notifications@github.com wrote:

I've just released version 1.14 with the new validations.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stefankoegl/python-json-pointer/issues/20#issuecomment-340563566, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUIXuV1HhfqbXONoURuDrchEf9UY9SFks5sxiiXgaJpZM4N9TD4 .

Julian commented 6 years ago

Just confirming, looks spot on, thanks again.

Hoping to push out a jsonschema release with Draft 6 support containing it in the next few weeks.