common-workflow-language / common-workflow-language/cwltool

Incorrect validation warning when combining "scatter" and "when"

Open
#1,639 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Expected Behavior
Should not give a warning when scattering with a conditional connects to an array of optional values.

## Actual Behavior
It gaves a warning because the output type is computed incorrectly for the order of operations in a step that has both a scatter and a conditional.

## Workflow Code

```
inputs:
fastq1:
type: File
fastq2:
type: File?

steps:
fastq-validator:
run: tools/fastqValidator.cwl
in:
file:
- fastq1
- fastq2
out: [std_out]
scatter: file
when: $(inputs.file != null)

adjust-names:
in:
fqValidator: fastq-validator/std_out
out: [fq1, fq2]
run: adjust-names.cwl
```

```
workflow.cwl:21:11: Source 'std_out' of type ["null", {"type": "array", "items": "File"}] may be
incompatible
workflow.cwl:28:7: with sink 'fqValidator' of type {"type": "array", "items": ["null", "File"]}
Source is from conditional step and may produce `null`
```
The checker is using the wrong type for `fastq-validator/std_out`, it should be {"type": "array", "items": ["null", "File"]}.

## Your Environment
cwltool 3.1.20220221215214

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.