Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using YAML / JSON workflow definition, input type is forced to JObject #1298

Open
heisk3478 opened this issue Sep 20, 2024 · 0 comments

Comments

@heisk3478
Copy link

Describe the bug
When using yaml / json workflow definition, DefinitionLoader.BuildObjectInputAction method will convert dictionary to JObject.
Which means we can't use dictionary as the input type in any step class. Basically https://github.com/danielgerlag/conductor/blob/master/src/Conductor.Steps/HttpRequest.cs#L21 won't work with yaml definition.

To Reproduce
The following yaml will fail since Headers section will be converted to JObject.

    StepType: Conductor.Steps.HttpRequest, Conductor
    Inputs:
      BaseUrl: '"https://reqres.in/"'
      Resource: '"/api/login"'
      Method: '"POST"'
      Headers:
        "@apiKey": environment["LOGNAME"]

Expected behavior
Dictionary type input should work with yaml workflow definition.

Additional context
Error message:

Object of type 'Newtonsoft.Json.Linq.JObject' cannot be converted to type 'System.Collections.Generic.IDictionary`2[System.String,System.Object]'.

Stacktrace:

   at System.RuntimeType.CheckValue(Object& value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.<>c__DisplayClass12_0.<BuildObjectInputAction>g__acn|0(IStepBody pStep, Object pData, IStepExecutionContext pContext)
   at WorkflowCore.Models.ActionParameter`2.Assign(Object data, IStepBody step, IStepExecutionContext context)
   at WorkflowCore.Models.ActionParameter`2.AssignInput(Object data, IStepBody body, IStepExecutionContext context)
   at WorkflowCore.Services.WorkflowExecutor.ExecuteStep(WorkflowInstance workflow, WorkflowStep step, ExecutionPointer pointer, WorkflowExecutorResult wfResult, WorkflowDefinition def, CancellationToken cancellationToken)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant