Add Step Functions support for Variables and JSONata features #11906
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The AWS Step Functions API and Amazon States Language (ASL) have newly introduced support for the following features:
JSONata
query and transformation language as an alternative toJSONPath
.Changes
JSONata
QueryLanguage
field to specify whether to evaluate expressions usingJSONata
orJSONPath
(default). This can be set at the:{% %}
will be evaluated asJSONata
where present as the value of a non-Path ASL field, a JSON object field, or a JSON array element.Arguments
andOutput
fields replace usage of the input and output Path fields inJSONPath
(InputPath
,Parameters
,ResultSelector
,ResultPath
, andOutputPath
).Path
versions of fields are not supported, whereJSONata
enclosed expressions should be used instead.JSONata
variable called$states
with the following values:$states.input
: A state's raw input$states.result
: An API or sub-workflow's result (if successful)$states.errorOutput
: An error output (only available inCatch
)$states.context
: The context objectMap
stateItems
field has been added that accepts a JSON array or aJSONata
expression that must evaluate to an array.Choice
stateCondition
field for choice rules that accepts a boolean constant or aJSONata
expression that must evaluate to a boolean.JSONata
function library can be used when defining expressions. This replaces the usage of Step Functions' intrinsic functions.Worfklow Variables
JSONata
orJSONPath
states using the newAssign
field.$
prefix. For example, an assigned variablefoo
can be accessed with a$
like$foo
.JSONata
reference will require the{% %}
to enclose the statement i.eJSONPath
reference will require the ASL field to include a.$
suffix to follow the field name i.eInputPath
,ResultSelector
,ResultPath
, andOutputPath
.