Fix JSONPath syntax error with in filter after other filters#3999
Closed
caglareker wants to merge 1 commit intoalibaba:mainfrom
Closed
Fix JSONPath syntax error with in filter after other filters#3999caglareker wants to merge 1 commit intoalibaba:mainfrom
caglareker wants to merge 1 commit intoalibaba:mainfrom
Conversation
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.
|
|
Author
|
My bad, I can't sign the CLA. Closing this one! |
Collaborator
|
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. |
Author
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.
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
JSONPathParserto 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:
@.field=='value' && @.type in ('01','04'))Both scenarios now parse and evaluate correctly.
Fixes #3997