Skip to content

Commit d3ab802

Browse files
Copilotdanielgerlag
andcommitted
Properly handle primitive values (bool, int, etc.) in YAML inputs without quoting
Co-authored-by: danielgerlag <[email protected]>
1 parent 4cb4c84 commit d3ab802

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/WorkflowCore.DSL/Services/DefinitionLoader.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,21 @@ private void AttachInputs(StepSourceV1 source, Type dataType, Type stepType, Wor
243243
continue;
244244
}
245245

246+
// Handle primitive values (bool, int, etc.) directly
247+
if (input.Value != null && (input.Value.GetType().IsPrimitive || input.Value is bool || input.Value is int || input.Value is long || input.Value is double || input.Value is decimal))
248+
{
249+
var primitiveValue = input.Value;
250+
void primitiveAction(IStepBody pStep, object pData)
251+
{
252+
if (stepProperty.PropertyType.IsAssignableFrom(primitiveValue.GetType()))
253+
stepProperty.SetValue(pStep, primitiveValue);
254+
else
255+
stepProperty.SetValue(pStep, System.Convert.ChangeType(primitiveValue, stepProperty.PropertyType));
256+
}
257+
step.Inputs.Add(new ActionParameter<IStepBody, object>(primitiveAction));
258+
continue;
259+
}
260+
246261
throw new ArgumentException($"Unknown type for input {input.Key} on {source.Id}");
247262
}
248263
}

test/WorkflowCore.UnitTests/Services/DefinitionStorage/YamlInheritedPropertyIntegrationTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void ShouldBindInheritedPropertiesInYamlDefinition()
3131
StepType: WorkflowCore.TestAssets.Steps.IterateListStep, WorkflowCore.TestAssets
3232
Inputs:
3333
Collection: ""data.DataList""
34-
RunParallel: ""false""
34+
RunParallel: false
3535
";
3636

3737
// Act & Assert

0 commit comments

Comments
 (0)