-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
@aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsRelated to AWS StepFunctionsbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
Describe the bug
The Map.ItemSelector doesn't support specifying JSONata while it being supported by AWS when configuring it manually.
I have following step function definition in AWS:
{
"StartAt": "Map",
"States": {
"Map": {
"Type": "Map",
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "INLINE"
},
"StartAt": "Pass",
"States": {
"Pass": {
"Type": "Pass",
"End": true
}
}
},
"End": true,
"QueryLanguage": "JSONata",
"ItemSelector": "{% $merge([$states.input, {\"item\": $states.context.Map.Item.Value}]) %}",
"Items": "{% $states.input.data %}"
}
}
}The map step passes full input (without needing to specify every individual property) while also adding map's item as new property to the input.
So if input of state machine is
{
"data": ["a", "b"],
"other": "c"
}then first Pass step will get following in the input:
{
"data": ["a", "b"],
"other": "c",
"item": "a"
}Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
No response
Expected Behavior
No error during synthesis
Current Behavior
Synthesis error: TypeError: type of argument item_selector must be one of (Mapping[str, Any], NoneType); got str instead
Reproduction Steps
aws_stepfunctions.Map(
self,
'Map',
query_language=aws_stepfunctions.QueryLanguage.JSONATA,
items=aws_stepfunctions.ProvideItems.jsonata('{% $states.input.data %}'),
item_selector='{% $merge([$states.input, {"item": $states.context.Map.Item.Value}]) %}',
)Possible Solution
- Extend restricted type to string as well
- Provide some helper function which will accept JSONata string and which will be accepted by type checking
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.198.0
AWS CDK CLI version
2.1016.1 (build 6de56b2)
Node.js Version
v22.9.0
OS
Ubuntu
Language
Python
Language Version
Python 3.13.3
Other information
No response
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsRelated to AWS StepFunctionsbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1