Allow filtering dictionaries using entry keys #74
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.
Before this commit, it was not possible to filter on the value of
object entries based on their keys such as in the following example
Given the input
The JSONPath
$[?(@.foo==42)]
did not produce any results and thereforeis was only possible to access top-level dictionary entries, but not to
produce or not to produce a result at all based on the value of such a
top-level entry.
This commit implements this feature while trying to keep up all other
working path expressions known from the test cases.
Interestingly, one test case specifically tried to prevent these
semantics (at a deeper level of the document structure). This case had
to be removed to make the test suite pass again. I could not find the
underlying issue number 2 to find out why this test case existed as that
issue seems to stem from a parent of this fork from long ago. Maybe, a
resulting release should therefore receive a major version bump as this
might be understood as a breaking change.
In general, the specification is pretty lose on how square brackets and
filter expression are to be understood in the case of dictionaries, not
lists. The implementations here follows the already existing practical
approach that simply makes more expressions and intended use cases
working. However, this results in multiple paths being valid to access
the same objects and therefore an ambiguity is created.
Fixes #66