Sequence Action Handler - "shareParameters" option
shareParameters allow to share parameters across child actions instead of creating cloned version to split branches.
Usage example:
1
# set default parameters
2
$parameters:
3
test: false
4
5
'--':
6
- fn: |-
7
parameters.test = true
8
9
- ctx:
10
'$.test':
11
inline: $ref:parameters.test
Copied!
As a result of execution ctx.test will have false value, ad -- clones parameters for each of the actions. Meaning fn function that modifies the parameters will have no affect on ctx.
But, if we add $shareParameters metadata, things will change:
1
# set default parameters
2
$parameters:
3
test: false
4
5
'--':
6
# tell action to share parameters
7
shareParameters: true
8
actions:
9
- fn: |-
10
parameters.test = true
11
12
- ctx:
13
'$.test':
14
inline: $ref:parameters.test
Copied!
As a result of execution ctx.test will now have true value.
Note: this is actually an anti-pattern: parameters modification is shadowed and might not be obvious. Make sure to use shareParameters only when necessary.
Last modified 3yr ago
Copy link