mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
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:
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);
|
||||
}
|
||||
|
||||
+33
@@ -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("""
|
||||
|
||||
Reference in new issue
Block a user