我在我的状态机中定义了以下状态。
"loop":{
"Type": "Pass",
"Result":{
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
},
"ResultPath": "$.iteration",
"Next":"iterateLoop"
},
我希望状态的输出是:
"newFieldsResponse": {
"isSuccess": true,
"error": "",
"body": {
"count": 2,
"fields": [...]
}
},
"iteration": {
"totalCount": 5,
"currentCount": 0,
"step": 1
}
}
迭代属性被添加到输入中,totalCount 属性被设置为字段数组中的项目数。
但是,“迭代”属性的输出设置为:
"iteration": {
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
}
看起来值 "$.newFieldsResponse.body.count"没有得到解析,而是按原样输出。
有什么我做错了吗?有人可以就如何使其工作提出建议吗?
最佳答案
这可以通过 "Parameters" 实现在 pass state
JSON
{
"loop": {
"Type": "Pass",
"Parameters": {
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
},
"ResultPath": "$.iteration",
"Next": "iterateLoop"
}
}
关于json - AWS Step Function - 向传递状态类型添加动态值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54452861/