Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpressionTool doesn't check output types #1811

Open
GlassOfWhiskey opened this issue Feb 23, 2023 · 2 comments
Open

ExpressionTool doesn't check output types #1811

GlassOfWhiskey opened this issue Feb 23, 2023 · 2 comments

Comments

@GlassOfWhiskey
Copy link
Contributor

CWL Specification explicitly states that

The Any type validates for any non-null value.

However, cwtool does not fail when a step produces a null output for a port of type Any. Instead, the behavior is correct for input ports. As a concrete example, the following ExpressionTool should clearly fail, but it doesn't.

#!/usr/bin/env cwl-runner

class: ExpressionTool
requirements: { InlineJavascriptRequirement: {} }
cwlVersion: v1.0

inputs: []

outputs:
  output: Any

expression: "$({'output': null })"

Note also that this file is involved in 2 CWL Conformance tests cases, step_input_default_value_overriden_2nd_step_null and step_input_default_value_overriden_2nd_step_null_noexp. Therefore, it is quite crucial to establish the correct behavior here.

@GlassOfWhiskey GlassOfWhiskey changed the title Steps with null outputs should file when expected type is Any Steps with null outputs should file when expected type is Any Feb 23, 2023
@GlassOfWhiskey
Copy link
Contributor Author

The problem is caused by the fact that cwltool does not apaprently run output tyoe validation after ExpressionTool executions. Conversely, it behaves correctly with CommandLineTool objects.

@GlassOfWhiskey GlassOfWhiskey changed the title Steps with null outputs should file when expected type is Any Steps with null outputs should fail when expected type is Any Feb 25, 2023
@GlassOfWhiskey
Copy link
Contributor Author

GlassOfWhiskey commented Feb 28, 2023

Also this ExpressionTool object is not failing, while it should

cwlVersion: v1.2
class: ExpressionTool
requirements:
  InlineJavascriptRequirement: {}
inputs: []
outputs:
  wrong_type_output: int
expression: "$({'wrong_type_output': 'This is a terrible error!!!'})"

This confirms that no output check is currently running for ExpressionTool objects.

Proposed solution:

@mr-c mr-c changed the title Steps with null outputs should fail when expected type is Any ExpressionTool doesn't check output types Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant