Skip to content

JSON Pointer reference parsing fails when pointing the root document #148

@Viicos

Description

@Viicos

While uncommon, I believe it is possible to have an empty JSON Pointer (i.e. ""), referencing the root of the document (see examples in the RFC).

Here is a regression test:

resource = Resource.opaque(contents={"foo": "baz"})
resolver = Registry().resolver()
assert resource.pointer("", resolver=resolver).contents == {"foo": "baz"}

Current behavior:

referencing.exceptions.PointerToNowhere: '' does not exist within {'foo': 'baz'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions