Skip to content

Add Defaultable for CommandInputRecordField #54

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions Process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ $graph:
jsonldPredicate: "rdfs:label"
doc: "A short, human-readable label of this object."

- name: Defaultable
type: record
abstract: true
fields:
- name: default
type: CWLObjectType?
jsonldPredicate:
_id: "sld:default"
_container: "@list"
noLinkCheck: true
doc: |
The default value for this parameter. When it occurs in a CommandLineTool,
it is used if the parameter is missing from the input object, or if the value
of the parameter in the input object is `null`. When it occurs in a Workflow,
it is used if there is no `source` field, or the value produced by the `source`
is `null`. Default values are applied before scattering or evaluating expressions
(e.g. dependent `valueFrom` fields).

- name: Identified
type: record
Expand Down Expand Up @@ -286,7 +303,7 @@ $graph:

- name: InputRecordField
type: record
extends: [CWLRecordField, FieldBase, InputFormat, LoadContents]
extends: [CWLRecordField, FieldBase, InputFormat, LoadContents, Defaultable]
specialize:
- specializeFrom: CWLRecordSchema
specializeTo: InputRecordSchema
Expand Down Expand Up @@ -372,19 +389,7 @@ $graph:
- name: InputParameter
type: record
abstract: true
extends: [Parameter, InputFormat, LoadContents]
fields:
- name: default
type: CWLObjectType?
jsonldPredicate:
_id: "sld:default"
_container: "@list"
noLinkCheck: true
doc: |
The default value to use for this parameter if the parameter is missing
from the input object, or if the value of the parameter in the input
object is `null`. Default values are applied before evaluating expressions
(e.g. dependent `valueFrom` fields).
extends: [Parameter, InputFormat, LoadContents, Defaultable]


- name: OutputParameter
Expand Down
12 changes: 1 addition & 11 deletions Workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ $graph:

- type: record
name: WorkflowStepInput
extends: [Identified, InputSink, LoadContents, Labeled]
extends: [Identified, InputSink, LoadContents, Labeled, Defaultable]
docParent: "#WorkflowStep"
doc: |
The input of a workflow step connects an upstream parameter (from the
Expand Down Expand Up @@ -387,16 +387,6 @@ $graph:
should be filtered out.

fields:
- name: default
type: CWLObjectType?
doc: |
The default value for this parameter to use if either there is no
`source` field, or the value produced by the `source` is `null`. The
default must be applied prior to scattering or evaluating `valueFrom`.
jsonldPredicate:
_id: "sld:default"
_container: "@list"
noLinkCheck: true
- name: valueFrom
type:
- "null"
Expand Down
9 changes: 9 additions & 0 deletions conformance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3525,3 +3525,12 @@
an_array_of_mixed_booleans: [ false, true, false ]
an_array_of_trues: [ true, true, true ]
an_int: 42

- id: record_default_field
job: tests/empty.json
tool: tests/record-default-field.cwl
doc: handling default value in fields of a record object
tags: [ required, command_line_tool ]
output:
v1: f1
v2: f2
23 changes: 23 additions & 0 deletions tests/record-default-field.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cwlVersion: v1.3.0-dev1
class: CommandLineTool
inputs:
record_input:
type:
type: record
fields:
f1:
type: string
default: "f1"
f2:
type: string
default: "f2"
arguments: ['true']
outputs:
v1:
type: string
outputBinding:
outputEval: $(inputs.record_input.f1)
v2:
type: string
outputBinding:
outputEval: $(inputs.record_input.f2)
Loading