Conversation
|
@stefankoegl Could you please review this PR? |
|
Hi! Thanks for your contribution! As requests is not part of the standard library, I am hesitant of adding a dependency for a single call. Can you change that to unquote from the stdlib? Also I am not sure if it makes sense to use the same call to detect and process both kinds of json pointer representations. Can you please elaborate a bit on your use case? |
|
I can use the stdlib version. I think there's some quirks between python2 and python3 so I'll be sure to keep that in mind. The use case is that I have json schemas which have internal refs, e.g. I am manipulating these schemas and have a need to fetch the object pointed by the refs. rfc6901 says that it supports this type of pointer so I think it makes sense to process both kinds in the init. I am not sure I understand what you mean by using a different call. |
|
I don't think this is correct in its current form as it causes the JsonPointer class to accept syntax that isn't JSON Pointer. RFC 6901 section 6 talks about how to layer the URI syntax with JSON Pointer syntax:
This isn't the same thing as saying that "#" is part of the JSON Pointer syntax. Rather, you should use a URL parser such as hyperlink to parse the URL, then use the pointer from the fragment normally. For example: from hyperlink import URL
from jsonpointer import JsonPointer
url = URL.from_text(u'#/definitions/bar')
pointer = JsonPointer(url.fragment)Note that JSON Schema's |
Json pointers which start with '#' are currently not supported. This adds support for them.
Note: I am adding a dependency on
requests, but I am not sure if that comes with standard python now.