Closed SchepiLove closed 6 months ago
Everything was solved by passing to the input only those fields that were required in this expression. But filtering still had to be moved to jsonPath, because validation did not pass on the expression
"expression": "Java.from($.statuses).filter(function (el) { return el.toLowerCase() !== 'ok' }).length > 0"
Describe the bug When loading workflow definition with SWITCH type tasks with JS expressions, I get validation error. Also, when loading workflow definition in task there are no inputParameters, which can lead to erroneous execution of eval()
Object returnValue = ScriptEvaluator.eval(expression, inputParameters);
Details Conductor version: 3.16.0 Persistence implementation: Redis Queue implementation: Dynoqueues Lock: Redis Task definition: SWITCH
To Reproduce Сreate a workflow definition with a SWITCH type task with an expression:
Get the logs: ConstraintViolationImpl{interpolatedMessage='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK', propertyPath=tasks[12], rootBeanClass=class com.netflix.conductor.common.metadata.workflow.WorkflowDef, messageTemplate='Expression is not well formatted: TypeError: Cannot read property "resultCode" from undefined in at line number 10, taskType: SWITCH taskName SWITCH_TASK'}
Expected behavior Before the upgrade, these tasks with expressions worked properly and eval() returned the expected result
Additional context changes in validation with version upgrade: https://github.com/Netflix/conductor/pull/3805