Skip to content

fix: use containing object as filter parent - #294

Closed
Narek-Khachikyan wants to merge 1 commit into
JSONPath-Plus:mainfrom
Narek-Khachikyan:fix/object-filter-parent
Closed

Narek-Khachikyan wants to merge 1 commit into
JSONPath-Plus:mainfrom
Narek-Khachikyan:fix/object-filter-parent

Conversation

@Narek-Khachikyan

Copy link
Copy Markdown

PR description

Object filters receive the containing object's parent as @parent, so $.foo.bar[?(@parent.id === 3)] tests the grandparent instead of bar. Pass the containing object to the evaluator for object filters. Keep the documented array-filter behavior.

Fixes #135.

Proof: the regression fails in both evaluators before the fix. pnpm test passes with 386 tests and 100% coverage; lint, type checks, build, and checks across all six bundles pass.

Checklist

  • - Added tests
  • - Ran npm test, ensuring linting passes
  • - Adjust README documentation if relevant

@Narek-Khachikyan Narek-Khachikyan closed this by deleting the head repository Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@parent does not actually point to parent when used in a filter on an object

1 participant