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.
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
Allow quotes to be escaped in JSON path #12033
Allow quotes to be escaped in JSON path #12033
Changes from all commits
f60cd94
4627a79
165e829
bc102a5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should this not be an error if
backslash
is true?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.
we ignore other backslashes as we do for regular (non quoted) JSON paths
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.
Hm, but then returning an empty result here doesn't seem correct to me - shouldn't we match
x\
as the string literal'x\'
in that case, instead of returning an empty result? Could we add such a test?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.
Ah right, I understand the confusion. If
ptr == end || backslash
, we return an empty result, which will cause a descriptive error, pointing to the location where the error occurred. So, if we have$."x\
as a path, you will get an errorThere 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.
That seems a bit inconsistent, no? We accept a backslash as a regular backslash except when it is the last character? I would say we should turn it into a regular backslash in this scenario perhaps?
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.
When you have the path
$."x\
, we need to throw an error, because the path is "escaped", i.e., the object key starts with a"
, so it needs to end with a"
too. If it ends with a backslash, it's wrong. Actually, I just realised that it can be removed from the check, since,ptr == end
will be true