common-workflow-language / cwltool

Common Workflow Language reference implementation
https://cwltool.readthedocs.io/
Apache License 2.0
335 stars 230 forks source link

Validation: matching types flagged as incompatible for multiple inputs #929

Open ghost opened 6 years ago

ghost commented 6 years ago

A workflow with single optional array input connecting to node with optional array input passes validation. A workflow with a pair of optional array inputs connecting to same node with merge_flattened raises compatibility warnings.

Expected Behavior

Workflow should pass with no warnings, since the inputs are of matching types.

Actual Behavior

cwltool --validate --non-strict multi-input-flattened.cwl
/Users/kghose/miniconda2/envs/cwl/bin/cwltool 1.0.20180923172926
Resolved 'multi-input-flattened.cwl' to 'file:///Users/kghose/Work/cwltool-bugs/link_merge/multi-input-flattened.cwl'
Workflow checker warning:
multi-input-flattened.cwl:7:5:  Source 'in1' of type ["null", {"type": "array", "items": "string"}]
                                may be incompatible
multi-input-flattened.cwl:18:9:   with sink 'array' of type ["null", {"type": "array", "items":
                                  "string"}]
                                  source has linkMerge method merge_flattened
multi-input-flattened.cwl:9:5:  Source 'in2' of type ["null", {"type": "array", "items": "string"}]
                                may be incompatible
multi-input-flattened.cwl:18:9:   with sink 'array' of type ["null", {"type": "array", "items":
                                  "string"}]
                                  source has linkMerge method merge_flattened
multi-input-flattened.cwl is valid CWL.

Workflow Code

app.cwl:

class: CommandLineTool
cwlVersion: v1.0
id: app
baseCommand:
  - echo
inputs:
  - id: array
    type: 'string[]?'
    inputBinding:
      position: 0
outputs:
  - id: output
    type: File?
    outputBinding:
      glob: '*.txt'
label: app
requirements:
  - class: DockerRequirement
    dockerPull: alpine
stdout: out.txt

multi-input-flattened.cwl:

class: Workflow
cwlVersion: v1.0
id: multi_input_flattened
label: multi-input-flattened
inputs:
  - id: in1
    type: 'string[]?'
  - id: in2
    type: 'string[]?'
outputs:
  - id: output
    outputSource:
      - app/output
    type: File?
steps:
  - id: app
    in:
      - id: array
        linkMerge: merge_flattened
        source:
          - in1
          - in2
    out:
      - id: output
    run: ./app.cwl
    label: app
requirements:
  - class: MultipleInputFeatureRequirement

single-input.cwl:

class: Workflow
cwlVersion: v1.0
id: single_input
label: single-input
inputs:
  - id: in1
    type: 'string[]?'
outputs:
  - id: output
    outputSource:
      - app/output
    type: File?
steps:
  - id: app
    in:
      - id: array
        source: in1
    out:
      - id: output
    run: ./app.cwl
    label: app
requirements: []
migbro commented 2 years ago

This is causing one of our workflows to fail validation - any chance this will get worked on?

migbro commented 2 years ago

Thanks in advance, really appreciate it!

tetron commented 2 years ago

This is causing one of our workflows to fail validation - any chance this will get worked on?

Actually failing or just giving an annoying warning?

I agree that it looks like either the type checking is bugged, or the warning message is bugged.

dmiller15 commented 2 years ago

Actually, I think our issue might be something else unrelated to this issue. You can ignore @migbro's and my complaint.

tetron commented 2 years ago

Thanks for the follow up, we'll investigate but I'm glad it isn't blocking you.