-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix(#12318): Fixes a bug in evaluation of JSONPath for wildcard and s… #12366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…card and slices patterns executed on a missing array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.
All contributors have signed the CLA ✍️ ✅ |
I wanted to add a label as |
I have read the CLA Document and I hereby sign the CLA |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @marcodallasanta for contributing to LocalStack and providing a solution for #12318! Your proposed approach will definitely help unblock this scenario.
I just have a minor refinement request regarding the snapshot tests. Specifically, could you please update your PR to ensure that only the snapshot information relevant to your new test case is included? Additionally, please make sure to incorporate your test case changes into the validation file.
For reproducibility, kindly avoid manually editing the generated files. Instead, use transformers within the sfn_snapshot
instance if necessary (though this should not be required in this case).
If you’d prefer, I’d also be happy to take care of these changes—just let me know!
Thanks again, looking forward to merging this soon!
Thank you @MEPalma, will try myself just to gain a more experience with the repo in case I will contribute again, but if it takes too long I will leave it to you. |
…pdate snapshot and validation
…n validation.json
Hey @MEPalma, I did what you suggested above:
Let me know if there's anything else that needs to be done before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time to address the comments, and once again, for your valuable contribution to the project!
Motivation
This is an attempt to fix issue #12318
Changes
Changes jsonpath.py.
When no matches, then it checks if the pattern of the JSONPath contains an array slice or wildcard, if so it gracefully returns an empty array instead of failing with NoSuchJsonPathError.
There's an exception though, if the JSONPath starts with an array slice syntax than it should fail.
Testing
There's a parameterised test for each of the pattern I identified to be problematic, but below there's a little script if it can help in diagnose issues