fix(sfn): return empty objects for null state paths (#3371)

Co-authored-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
This commit is contained in:
XuJianandxujiantop-crypto authored and GitHub committed 2026-09-10 15:22:07 -04:00
1 parent d99f162eb6
commit 3090e333d4
2 files changed
+35 -2

No files matched your search

@@ -3013,7 +3013,7 @@ public class AslExecutor {
}
String path = stateDef.get("InputPath").asText();
if (path == null || path.equals("null")) {
return NullNode.getInstance();
return objectMapper.createObjectNode();
}
return resolvePath(path, input);
}
@@ -3038,7 +3038,7 @@ public class AslExecutor {
}
String path = stateDef.get("OutputPath").asText();
if (path == null || path.equals("null")) {
return NullNode.getInstance();
return objectMapper.createObjectNode();
}
return resolvePath(path, output);
}
@@ -132,6 +132,39 @@ class AslExecutorStatePathTest {
"{\"source\":\"right\"}");
}
@Test
void passInputPathNullDiscardsInputAsEmptyObject() throws Exception {
assertOutput("""
{"StartAt":"Pass","States":{
"Pass":{"Type":"Pass","InputPath":null,"End":true}}}
""",
"{\"discarded\":true}",
"{}");
}
@Test
void passOutputPathNullDiscardsOutputAsEmptyObject() throws Exception {
assertOutput("""
{"StartAt":"Pass","States":{
"Pass":{"Type":"Pass","OutputPath":null,"End":true}}}
""",
"{\"discarded\":true}",
"{}");
}
@Test
void mapIteratorOutputPathNullProducesEmptyObjects() throws Exception {
assertOutput("""
{"StartAt":"Each","States":{
"Each":{"Type":"Map","ItemsPath":"$.ids","MaxConcurrency":1,
"Iterator":{"StartAt":"Pass","States":{
"Pass":{"Type":"Pass","OutputPath":null,"End":true}}},
"End":true}}}
""",
"{\"ids\":[1,2]}",
"[{},{}]");
}
@Test
void parallelInputPathFeedsBranchesAndResultPathStillMergesIntoOriginalInput() throws Exception {
assertOutput("""