if (defined(x)) and optionals

pshapiropshapiro Member, Broadie
edited January 2018 in Ask the Cromwell + WDL Team

We're updating to Cromwell 30 and are seeing some changes where 30 is stricter than 29 on what it will allow. One case we've seen is where we have a task that executes inside a conditional block, such as

if (defined(x)) {
  call Task { input: x = x }

Now Cromwell requires that x is declared as optional in our task Task. Is there a form where we can enforce that an object is defined and bind a new object to the non-optional type? We'd rather not propagate optionals throughout our workflow, especially in cases where we know the inputs are always defined. We've come up with workarounds like:

if (defined(x)) {
  call Task { input: x = ${default="can never happen!" x}}

but this seems like a hack.

Best Answer


Sign In or Register to comment.