Skip to content

Fix JSONPath syntax error with in filter after other filters#3999

Closed
caglareker wants to merge 1 commit intoalibaba:mainfrom
caglareker:fix/issue-3997-bug-jsonpath-syntax-error-when-other-fil
Closed

Fix JSONPath syntax error with in filter after other filters#3999
caglareker wants to merge 1 commit intoalibaba:mainfrom
caglareker:fix/issue-3997-bug-jsonpath-syntax-error-when-other-fil

Conversation

@caglareker
Copy link

Summary

Fix a parser error that occurred when using an 'in' filter in combination with other filters in JSONPath expressions. The parser was unconditionally requiring a closing parenthesis after parsing filters, which caused syntax errors when the 'in' filter's own parentheses were present.

Changes

Modify the filter parsing logic in JSONPathParser to only enforce the closing parenthesis requirement when the filter expression itself is wrapped in parentheses. This allows 'in' filters with their own parenthetical syntax to work correctly after other filter conditions.

Testing

Add test cases validating:

  1. An 'in' filter used after other filter conditions (e.g., @.field=='value' && @.type in ('01','04'))
  2. An 'in' filter used before other filter conditions

Both scenarios now parse and evaluate correctly.

Fixes #3997

When parsing filter expressions, the parser was unconditionally requiring
a closing parenthesis even when the filter wasn't wrapped in parentheses.
This caused errors when an 'in' filter followed other filter conditions,
since the 'in' filter has its own parenthetical syntax.

Only enforce the closing parenthesis requirement when the filter itself is
wrapped in parentheses.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@caglareker
Copy link
Author

My bad, I can't sign the CLA. Closing this one!

@caglareker caglareker closed this Feb 26, 2026
@jujn
Copy link
Collaborator

jujn commented Feb 28, 2026

LGTM. Thank you for your contribution! If you're really unable to sign the CLA, I think we can make an exception and merge it anyway. Please reopen it.

@caglareker
Copy link
Author

hey @jujn, i resubmited as #4001 since i already deleted the fork. same exact changes

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.

[BUG] jsonpath syntax error when other filters are followed by 'in' filter

3 participants