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

ExpressionTools can return 'null' for type Any, but not CommandLineTools using cwl.output.json

Open
#1,369 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

## Expected Behavior

```
$ cwltool v1.0/null-expression3-tool.cwl
Error validating output record. the `output` field is not valid because
'Any' type must be non-null
in {
"output": null
}
```

## Actual Behavior
```
$ cwltool v1.0/null-expression3-tool.cwl

{
"output": null
}
INFO Final process status is success
```

## Workflow Code
The ExpressionTool: https://github.com/common-workflow-language/common-workflow-language/blob/6a955874ade22080b8ef962b4e0d6e408112c1ef/v1.0/v1.0/null-expression2-tool.cwl

and the equivalent CommandLineTool
``` cwl
#!/usr/bin/env cwl-runner
class: CommandLineTool
inputs: []
outputs:
- id: output
type: Any
requirements:
- class: InitialWorkDirRequirement
listing:
- entryname: expression.js
entry: |-
"use strict";
var inputs=$(inputs);
var runtime=$(runtime);
var ret = function(){return {'output': null };}();
process.stdout.write(JSON.stringify(ret));
hints:
- class: DockerRequirement
dockerPull: node:slim
- class: SoftwareRequirement
packages:
- package: nodejs
cwlVersion: v1.0
baseCommand:
- nodejs
- expression.js
stdout: cwl.output.json
```

```

## Your Environment
* cwltool version: 3.0.20201113073442

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.