sdk-go
sdk-go copied to clipboard
JQ Expressions in Unit Test not consistent with specs standards and examples
I was looking at adding unit test and looked at parser/testdata/workflows/applicationrequest.json
with the following DSL:
...
"dataConditions": [
{
"condition": "{{ $.applicants[?(@.age >= 18)] }}",
"transition": {
"nextState": "StartApplication"
}
},
...
I noticed that "condition" expression is not in accordance with the specs - the specs says that Jq expression should be within the ${ }
rather than {{ }}
- is this a mistake or is this intentional (ie. different expression language) ?
Also in the [1.7 versions of the examples in the specs] (https://github.com/serverlessworkflow/specification/blob/v0.7/examples/README.md#Applicant-Request-Decision-Example), it was
...
"dataConditions": [
{
"condition": "${ .applicants | .age >= 18 }",
"transition": "StartApplication"
},
...
I noticed that "condition" expression is not in accordance with the specs - the specs says that Jq expression should be within the ${ } rather than {{ }} - is this a mistake or is this intentional (ie. different expression language) ?
I think I don't understand your question. The question is whether or not the SDK should validate the expression?
Actually, I was wondering why the test json specs do not use jq expressions and which expression language is used?
It's jsonpath if I recall correctly. But the SDK is not parsing the expressions, so won't matter.
I think we can add at least a validation to the expressions based on the workflow.expressionLang
attribute.
Should we close the issue because all jsonpath have been changed to jq:
- https://github.com/serverlessworkflow/sdk-go/pull/73