Skip to content

Expected behavior for jsonpath in when clause if path is missing #12546

Closed Answered by apiwoni
apiwoni asked this question in Q&A
Discussion options

You must be logged in to vote

I'm answering my question here but additional ideas and notes are welcome.

So yes, invalid 'when' expression also happens when actual path is missing for jsonpath.

Here's one way to handle it:

tasks.TaskName.outputs != nil && 
tasks.TaskName.outputs.parameters.parameterName != nil &&
tasks.TaskName.outputs.parameters.parameterName contains 'propertyName' &&
jsonpath(tasks.TaskName.outputs.parameters.parameterName, '$.propertyName') != 'true'

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@agilgur5
Comment options

Answer selected by agilgur5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/templating Templating with `{{...}}` type/support User support issue - likely not a bug
2 participants