Skip to content

Handle null roots in empty JSON pointers - #8

Open
bensynapse wants to merge 1 commit into
mattn:masterfrom
bensynapse:fix-null-root-pointer
Open

bensynapse wants to merge 1 commit into
mattn:masterfrom
bensynapse:fix-null-root-pointer

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

Get(root, "") now returns nil without an error when root comes from JSON null. Has(root, "") returns true.
Nonempty pointers still fail on null.

RFC 6901 defines the empty pointer as the whole document.
The tests cover every JSON root type and invalid child pointers. The null root case fails against the original source.

The CI race and coverage command passes on Go 1.21.13, 1.22.12 and 1.23.4:

go test -race -covermode=atomic -coverprofile=coverage.txt ./...

Build and vet pass on Go 1.23.4. The CLI also accepts null with an empty pointer.

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.

1 participant