我在step函数中有一个包含两个分支的并行任务。 输入是:
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
}
每个分支返回一个json结果,如下所示
分支1(我使用“OutputPath”:“$”):
{
"requestType": "GrantAccess",
"DBUser": "exists",
"ADUser": "exists"
}
分支2(我使用“ResultPath”:“$ .approvalStatus”):
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
"approvalStatus": "Approved"
}
当两个分支都完成时,并行任务的输出返回:
[
{
"requestType": "GrantAccess",
"DBUser": "exists",
"ADUser": "exists"
},
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
"approvalStatus": "Approved"
}
]
下一个任务是选择,
"Choices": [
{
"Variable": "$.input[1].approvalStatus",
"StringEquals": "Approved",
"Next": "ProcessRequest"
},
{
"Variable": "$.input[1].approvalStatus",
"StringEquals": "Declined",
"Next": "SendDeclineNotification"
}
]
并且它一直给我以下错误:
"cause": "An error occurred while executing the state 'CheckApprovalStatus' (entered at the event id #16). Invalid path '$.input[1].approvalStatus': The choice state's condition path references an invalid value."
所以这是我的问题,
1)我应该如何在选择任务中引用它来获取approvalStatus
值?
2)无论如何我可以使用json格式而不是数组返回并行任务吗?
提前致谢
答案 0 :(得分:3)
如果您不想更改ResultPath,我认为您应该使用类似"$[1].approvalStatus"
的内容。