Fix JSON Pointer array indices and index-like object keys #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We currently support JSON pointers with negative array indices, but the JSON Pointer specification (RFC 6901) does not allow negative array indexes. See #115.
This PR changes
JSONPointer.min_int_indexto be0, causing aJSONPointerIndexErrorwhen resolving a negative index against an array-like value.JSONPointer.min_int_indexcan be changed to a suitably negative integer if you need to support negative indices in your JSON pointers.New default behavior
Change the minimum allowed index
We've also refactored some
JSONPointerinternals so that an index-like pointer token can be resolved against an object value.Because of this, min and max int indices are now checked at pointer resolution time because we need data to know if we're resolving against an array value or an object value.