Skip to content

Commit 9479868

Browse files
authored
Do not serialize again json strings in conductor payloads. (#189)
The workflow inputs/outputs and step outputs are already returned as JSON strings from list workflows and get workflow steps.
1 parent c484edb commit 9479868

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

dbos/conductor_protocol.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,16 @@ func formatListWorkflowsResponseBody(wf WorkflowStatus) listWorkflowsConductorRe
137137
}
138138
}
139139

140-
// Convert input/output to JSON strings if present
140+
// input/output are already JSON strings
141141
if wf.Input != nil {
142-
inputJSON, err := json.Marshal(wf.Input)
143-
if err == nil {
144-
inputStr := string(inputJSON)
142+
inputStr, ok := wf.Input.(string)
143+
if ok {
145144
output.Input = &inputStr
146145
}
147146
}
148147
if wf.Output != nil {
149-
outputJSON, err := json.Marshal(wf.Output)
150-
if err == nil {
151-
outputStr := string(outputJSON)
148+
outputStr, ok := wf.Output.(string)
149+
if ok {
152150
output.Output = &outputStr
153151
}
154152
}
@@ -249,11 +247,10 @@ func formatWorkflowStepsResponseBody(step StepInfo) workflowStepsConductorRespon
249247
FunctionName: step.StepName,
250248
}
251249

252-
// Convert output to JSON string if present
250+
// output is already a JSON string
253251
if step.Output != nil {
254-
outputJSON, err := json.Marshal(step.Output)
255-
if err == nil {
256-
outputStr := string(outputJSON)
252+
outputStr, ok := step.Output.(string)
253+
if ok {
257254
output.Output = &outputStr
258255
}
259256
}

0 commit comments

Comments
 (0)