Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cowtowncoder opened this issue Jul 3, 2022 · 0 comments
Labels
2.14 Issue planned (at earliest) for 2.14
Milestone

Comments

@cowtowncoder
Copy link
Member

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.

@cowtowncoder cowtowncoder added the 2.14 Issue planned (at earliest) for 2.14 label Jul 3, 2022
@cowtowncoder cowtowncoder added this to the 2.14.0 milestone Jul 3, 2022
@cowtowncoder cowtowncoder changed the title JsonPointer.empty() should NOT indicate match of a property JsonPointer.empty() should NOT indicate match of a property with key of "" Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.14 Issue planned (at earliest) for 2.14
Projects
None yet
Development

No branches or pull requests

1 participant