-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Is your feature request related to a problem? Please describe.
It's unfortunate that when I launch a Workflow the arguments I pass to launch it are not typed. So I don't get a compiler check.
Describe the solution you'd like
The short version? I want launch to be smart enough to know what the first item in the Workflow expects for its WorkflowInput and have that type be what I pass as args. Additionally if that type is Never I want to be forbidden from passing args and if that type is not Never I want to be forced to pass args.
Potential solution:
Combine has Publishers that end up chaining in an interesting way with Generics that we could rip off. For example
Workflow(FR1.self) creates a Workflow. But Workflow(FR1.self).thenProceed(with: FR2.self) creates Workflow<FR2, Workflow<FR1>> or...something like that? The solution is not totally ironed out in my head, but the premise is that you'd be able to backtrack through all the nested Workflows until you got to the first one, thus knowing the FlowRepresentable type that comes first and asserting launch happens with the correct input.
Describe alternatives you've considered
I suppose there's a simpler approach that is a little less consumer friendly where they just pass the FlowRepresentable type that is going to be launched and we steal the WorkflowInput from it. I'm not really a fan because it adds an unneeded parameter.