mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(stepfunctions): preserve object details in PutEvents (#4022)
Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
This commit is contained in:
1 parent
eb18b4ab1f
commit
4c64f2e397
3 files changed
+89
-3
No files matched your search
@@ -41,6 +41,7 @@ import io.github.hectorvent.floci.services.stepfunctions.model.MockedResponseSte
|
||||
import io.github.hectorvent.floci.services.stepfunctions.model.MockedTestCase;
|
||||
import io.github.hectorvent.floci.services.stepfunctions.model.StateMachine;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
@@ -1413,7 +1414,7 @@ public class AslExecutor {
|
||||
private JsonNode invokeOptimizedPutEvents(JsonNode input, String region) throws Exception {
|
||||
Response response;
|
||||
try {
|
||||
response = eventBridgeHandler.handle("PutEvents", input, region);
|
||||
response = eventBridgeHandler.handle("PutEvents", normalizeOptimizedPutEventsInput(input), region);
|
||||
} catch (AwsException e) {
|
||||
throw new FailStateException(sdkExceptionName("EventBridge", e.getErrorCode()), e.getMessage());
|
||||
}
|
||||
@@ -1426,6 +1427,20 @@ public class AslExecutor {
|
||||
return result;
|
||||
}
|
||||
|
||||
private JsonNode normalizeOptimizedPutEventsInput(JsonNode input) throws JsonProcessingException {
|
||||
JsonNode normalized = input.deepCopy();
|
||||
JsonNode entries = normalized.path("Entries");
|
||||
if (entries.isArray()) {
|
||||
for (JsonNode entry : entries) {
|
||||
JsonNode detail = entry.get("Detail");
|
||||
if (entry.isObject() && detail != null && detail.isObject()) {
|
||||
((ObjectNode) entry).put("Detail", objectMapper.writeValueAsString(detail));
|
||||
}
|
||||
}
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* AWS SDK integration for {@code sfn:startSyncExecution}, the way an EXPRESS child workflow is
|
||||
* called. It differs from the optimized {@code states:startExecution.sync} integration in three
|
||||
|
||||
Reference in new issue
Block a user