Skip to content

null wrongly requires quoting #2221

@arunisaac

Description

@arunisaac

Here, I have a simple workflow in which the input message is optional. The type is specified as an array of string and null.

cwlVersion: v1.2
class: CommandLineTool
baseCommand: echo
inputs:
  message:
    type:
      - string
      - null
    inputBinding:
      position: 1
outputs: {}

When I run this workflow using cwltool, I get the following validation error:

$ cwltool foo.cwl
ERROR Tool definition failed validation:
foo.cwl:1:1: Object 'foo.cwl' is not valid because
               tried 'CommandLineTool' but
foo.cwl:4:1:     the 'inputs' field is not valid because
foo.cwl:5:3:       item is invalid because
foo.cwl:6:5:         the 'type' field is not valid because
                       tried array of <CWLType or CommandInputRecordSchema or CommandInputEnumSchema or CommandInputArraySchema or
                       string> but
                         item is invalid because
                           - tried CWLType but
                             value is a NoneType but expected a string
                           - tried CommandInputRecordSchema but
                             is not a dict. Expected a CommandInputRecordSchema object.
                           - tried CommandInputEnumSchema but
                             is not a dict. Expected a CommandInputEnumSchema object.
                           - tried CommandInputArraySchema but
                             is not a dict. Expected a CommandInputArraySchema object.
                           - tried string but
                             the value is not string

However, if I double quote the null in the type (line 8), the workflow validates normally. I suppose this is cwltool getting confused about YAML's type ambiguity. The correct behaviour in this context would be to treat null as the string "null".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions