Repository navigation
Conversation
Skip paths like `$..aaa.1` or `$..aaa..0` never matched anything, as jsonpath-ng only matches `Fields` against dicts. The existing tests did not catch it, because they ran after a bracket-notation assertion on the same session, which had already removed the values from the state. Numeric fields are now replaced after parsing with a field that acts as a list index when applied to a list, and as a regular key otherwise, since `$.a.1` and `$.a.'1'` are parsed identically. The tests now use a new session for every assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bentsku
marked this pull request as draft
October 7, 2026 23:09
bentsku
added this pull request to stack #29
October 7, 2026 23:09
bentsku
removed this pull request from stack #29
October 7, 2026 23:15
Contributor
Author
|
Closing: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Stacked on #27.
Skip paths using dot notation for list indices, like
$..aaa.1,$..aaa..0or$..aaa.0..aab.1, never matched anything, on jsonpath-ng 1.7 or 1.9. jsonpath-ng only matchesFieldsagainst dicts. The existing tests didn't catch this because each dot-notation assertion ran after a bracket-notation assertion on the same session, which had already removed the values. Skip paths using this syntax have been silently not applied.Changes
Fieldswith a_FieldOrIndexnode. It acts as a list index when applied to a list, and as a regular key otherwise. This has to be decided at match time, since$.a.1and$.a.'1'parse to the same AST, so numeric dict keys keep working.Known limitation: jsonpath-ng can't parse consecutive numeric fields like
$..aaa.2.0, because2.0is lexed as a float. Use$..aaa.2[0]instead. This is noted in the docstring.🤖 Generated with Claude Code