-
Notifications
You must be signed in to change notification settings - Fork 420
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
JSONPath filter expression is invalid #365
Comments
I tried a few more, but no luck
When I drop the filter it works fine:
|
/kind bug |
I tried on the latest codebase, adding a unit test in jsonpath_test.go with array filtering works fine:
|
Now that's interesting...I'd have expected that to fail |
The issue is with the The regex is Maybe we could use |
The need for a regex comes from the fact that we support embedding the jsonpath filter into text. |
yes, and that we support multiple jsonpath expressions in the same string
Yeah, especially since you can do that in templates already. I proposed something similar in #253 (Also related, #367) One issue here though is that we'd be making a breaking change in a patch release
Heh. Yeah I did try a couple on regex101. Though I think that needs recursion support which needs a PCRE implementation while the Go regex implementation uses Re2 Perhaps, we can get away with something hacky like splitting on |
We could have some code - not based on regex - that looks for balanced parenthesis after a |
/assign |
Yeah, since we are only really trying to remove the portion of the expression that tekton adds i.e. the leading
|
We were previously using a regex to extract expressions within TriggerBindings. The regex only extracted between the initial `$(` and the first occurrence of the `)`. This meant that some valid JSONPath expressions that contained brackets (e.g. filters) were incorrectly extracted. This commit fixes the issue by splitting the string on `$(` and then extracting until the *last* occurrence of `)`. Fixes tektoncd#365 Co-Authored-By: Andrea Frittoli <[email protected]> Signed-off-by: Dibyo Mukherjee <[email protected]>
We were previously using a regex to extract expressions within TriggerBindings. The regex only extracted between the initial `$(` and the first occurrence of the `)`. This meant that some valid JSONPath expressions that contained brackets (e.g. filters) were incorrectly extracted. This commit fixes the issue by splitting the string on `$(` and then extracting until the first "unbalanced" occurrence of `)`. Fixes tektoncd#365 Co-Authored-By: Andrea Frittoli <[email protected]> Signed-off-by: Dibyo Mukherjee <[email protected]>
We were previously using a regex to extract expressions within TriggerBindings. The regex only extracted between the initial `$(` and the first occurrence of the `)`. This meant that some valid JSONPath expressions that contained brackets (e.g. filters) were incorrectly extracted. This commit fixes the issue by splitting the string on `$(` and then extracting until the first "unbalanced" occurrence of `)`. Fixes tektoncd#365 Co-Authored-By: Andrea Frittoli <[email protected]> Signed-off-by: Dibyo Mukherjee <[email protected]>
We were previously using a regex to extract expressions within TriggerBindings. The regex only extracted between the initial `$(` and the first occurrence of the `)`. This meant that some valid JSONPath expressions that contained brackets (e.g. filters) were incorrectly extracted. This commit fixes the issue by splitting the string on `$(` and then extracting until the first "unbalanced" occurrence of `)`. Fixes tektoncd#365 Co-Authored-By: Andrea Frittoli <[email protected]> Signed-off-by: Dibyo Mukherjee <[email protected]>
We were previously using a regex to extract expressions within TriggerBindings. The regex only extracted between the initial `$(` and the first occurrence of the `)`. This meant that some valid JSONPath expressions that contained brackets (e.g. filters) were incorrectly extracted. This commit fixes the issue by splitting the string on `$(` and then extracting until the first "unbalanced" occurrence of `)`. Fixes #365 Co-Authored-By: Andrea Frittoli <[email protected]> Signed-off-by: Dibyo Mukherjee <[email protected]>
Expected Behavior
Given the expression:
$(body.taskRun.spec.outputs.resources[?(@.name == 'bucket')].resourceRef.name)
, the expression should be validActual Behavior
User gets a "unterminated expression" error
The text was updated successfully, but these errors were encountered: