PMCC-BioinformaticsCore / janis

[Alpha] Janis: an open source tool to machine generate type-safe CWL and WDL workflows
https://janis.readthedocs.io/
GNU General Public License v3.0
41 stars 13 forks source link

Union input types #10

Open illusional opened 4 years ago

illusional commented 4 years ago

Tools can often accept multiple input types, and that's something we want to reflect in Janis.

The simplest union types

It would be simple to add a Union(String, Int) operator into Janis and let the type system reflect this.

Localisation makes this harder

When you mix types that require localisation or secondary files. For example:

Solution

It's not practical to generate a specification in CWL and WDL that can accurately reflect this case. Instead, we'll likely generate multiple versions of the workflow schema, depending on what the input(s) are. This way we won't necessarily clash if the same tool is used with different types of inputs.

Likely, the Union will have a default type for when you just translate it.

Backwards compatibility

This will add a new DataType called Union, the introduction of which should not affect current workflows. With internal changes relating to this, our biggest goal is to keep the current API as is, and changes would only be required for tools hoping to take advantage of this feature.

So we're anticipating that previous workflows will be compatible with no code changes.