Skip to content

Commit e298ca2

Browse files
author
Tihomir Surdilovic
authored
Fix ambiguous JSONPath example in Workflow Data Expressions section (#170)
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 8375348 commit e298ca2

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

specification.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ Data flow during workflow execution can be divided into:
106106
### Workflow Data Expressions
107107

108108
Workflow model parameters may use expressions to access the JSON data.
109-
Note that different data filters play a big role as to which parts of the state data is queried against. Reference the
110-
[State Data Filtering](#State-Data-Filtering) section for more information.
109+
Note that different data filters play a big role as to which parts of the states data are selected. Reference the
110+
[State Data Filtering](#State-Data-Filtering) section for more information about data state data filters.
111111

112112
All expressions must follow the [JsonPath](https://github.com/json-path/JsonPath) format and can be evaluated with a JsonPath expression evaluator.
113113
JsonPath expressions can select and extract the workflow JSON data.
@@ -118,7 +118,7 @@ All expressions are written inside double braces:
118118
{{ expression }}
119119
```
120120

121-
Expressions should be resolved and the result returned exactly where the expression is written.
121+
Expressions should be resolved and the results returned exactly where the expression is written.
122122

123123
To show some expression examples, let's say that we have the following JSON data:
124124

@@ -180,24 +180,22 @@ Would set the data output of the particular state to:
180180
]
181181
```
182182

183-
Some parameters require an expression to resolve to a boolean (true / false). In this case JsonPath expressions can also be used.
184-
The expression should evaluate to true, if the result contains a subset of the JSON data, and false if it is empty. For example:
183+
[Switch state](#Switch-State) [conditions](#switch-state-dataconditions) require for expressions to be resolved to a boolean value (true / false).
184+
In this case JsonPath expressions can also be used.
185+
The expression should evaluate to true, if the result contains a subset of the JSON data, and false if it is empty.
186+
For example:
185187

186188
```json
187189
{
188-
"isAdult" : "{{ $.[?(@.age > 18)] }}"
189-
}
190-
```
191-
192-
would set the value if `isAdult` to true, as the expression returns a non-empty subset of the JSON data. Similarly
193-
194-
```json
195-
{
196-
"isChild" : "{{ $.[?(@.age < 18)] }}"
190+
"name": "Eighteen or older",
191+
"condition": "{{ $.applicants[?(@.age >= 18)] }}",
192+
"transition": {
193+
"nextState": "StartApplication"
194+
}
197195
}
198196
```
199197

200-
would return false as the result of the JsonPath expression is empty.
198+
In this case the condition would be evaluated to true if it returns a non-empty subset of the queried data.
201199

202200
JsonPath also includes a limited set of built-in functions that can be used inside expressions. For example the expression
203201

@@ -209,11 +207,12 @@ JsonPath also includes a limited set of built-in functions that can be used insi
209207

210208
would set the value of `phoneNums` to `2`.
211209

212-
As previously mentioned, expressions are evaluated against the subset of data that can see. For example
210+
As previously mentioned, expressions are evaluated against certain subsets of data. For example
213211
the `parameters` param of the [functionRef definition](#FunctionRef-Definition) can evaluate expressions
214212
only against the data that is available to the [action](#Action-Definition) it belongs to.
215213
One thing to note here are the top-level [workflow definition](#Workflow-Definition) parameters. Expressions defined
216-
in them can only be evaluated against the initial [workflow data input](#Workflow-Data-Input) JSON.
214+
in them can only be evaluated against the initial [workflow data input](#Workflow-Data-Input).
215+
217216
For example let's say that we have a workflow data input of:
218217

219218
```json

0 commit comments

Comments
 (0)