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

null wrongly requires quoting

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

Description

Here, I have a simple workflow in which the input `message` is optional. The type is specified as an array of `string` and `null`.
```scheme
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 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"`.

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.