Skip to content

JsonPointer.empty() should NOT indicate match of a property with key of "" #788

Closed
@cowtowncoder

Description

@cowtowncoder

Currently the "empty" JsonPointer instance (obtained by JsonPointer.empty() or trying to compile empty String (zero-length)) is distinct from one that matches empty property name, /, regarding behavior.
Empty JsonPointer matches the current node whereas one with "empty property" would match value of JSON Object with empty String. Specifically, for JSON Object like:

{ "" : "text" }
  1. JsonPointer.empty() would match JSON Object itself
  2. JsonPointer.compile("") would match the String value text

However: currently (as of 2.13), empty JsonPointer:

  • Returns '""' for getMatchingProperty()
  • Retuns true for mayMatchProperty()
  • But does NOT actually match with matchProperty("")

Of these, first 2 cases should be fixed.

It is understood that there may be backwards-compatibility challenges in changing the behavior: however, handling of the "empty" JsonPointer is important for proper handling of traversal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions