Skip to content
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

Improve quoteJQQuery reliability #205

Merged
merged 3 commits into from
Sep 17, 2024
Merged

Conversation

qgrp-m-kondratenko
Copy link
Contributor

I have found a bug when looking up values of objects that have dashes in the name, while being the first key after the scanned object name. In this PR, a few tests were added to replicate that issue as well as a fix for quoteJQQuery function, that was the source of the problem. The logic of quoteJQQuery was simplified to extract all indices and quote them depending on type, numbers with [] and all strings with [""]. Also, the behavior of quoteJQQuery was unified to run the same on queries with and without dashes, which improves the transparency of the query mechanism.

- Add a lookup test that failed when having object with dashes in the
  name after the scanned object name.
- Fix the quoteJQQuery to pass the test.
- Unify the quoteJQQuery processing algorithm for all queries, so no
  special behavior is used for queries with dashes.
- Add a lookup test with negative index.
- Fix quoteJQQuery to allow for negative indexes.
Add binary, built with go build to gitignore, so it does not
accidentally get commited.
@fujiwara
Copy link
Owner

@qgrp-m-kondratenko Thank you!

I confirmed the bug, and this patch solved it!
But I care if a performance degrades a bit. I'll tune it with another patch.

@fujiwara fujiwara merged commit de69972 into fujiwara:main Sep 17, 2024
2 checks passed
@fujiwara fujiwara mentioned this pull request Sep 17, 2024
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.

2 participants