Add support for uri fragments by Enaero · Pull Request #32 · stefankoegl/python-json-pointer · GitHub
Skip to content

Add support for uri fragments#32

Open
Enaero wants to merge 1 commit into
stefankoegl:masterfrom
Enaero:master
Open

Add support for uri fragments#32
Enaero wants to merge 1 commit into
stefankoegl:masterfrom
Enaero:master

Conversation

@Enaero

@Enaero Enaero commented Jul 2, 2018

Copy link
Copy Markdown

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.

@Enaero

Enaero commented Jul 9, 2018

Copy link
Copy Markdown
Author

@stefankoegl

Copy link
Copy Markdown
Owner

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?

@Enaero

Enaero commented Jul 12, 2018

Copy link
Copy Markdown
Author

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.

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "foo": { "$ref": "#/definitions/bar" }
  },
  "definitions": {
    "bar": {
      "type": "object",
      "properties": {
        "a": { "type": "string" },
        "b": { "type": "string" }
      }
    }
  }
}

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.

@twm

twm commented Sep 18, 2019

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

3 participants