Light, fluffy, and always free - The AWS Local Emulator alternative
fix(sfn): return empty objects for null state paths (#3371)
XuJian3090e333d4b6
diff --git a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.javaindex 726155a50a..a0ec52885f 100644--- a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java+++ b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java@@ -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);}diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorStatePathTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorStatePathTest.javaindex a856f35799..d901d77a22 100644--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorStatePathTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorStatePathTest.java@@ -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]}",+ "[{},{}]");+ }+@Testvoid parallelInputPathFeedsBranchesAndResultPathStillMergesIntoOriginalInput() throws Exception {assertOutput("""