Skip to content

Commit 03ca870

Browse files
author
Peter Amstutz
committed
Squashed 'cwltool/schemas/' changes from d6780795..f9d95cbd
f9d95cbd Refactor loadContents to be available on InputParameter, WorkflowStepInput, CommandOutputBinding. Note that InputBinding on WorkflowInputParameter is deprecated. Add conformance tests. git-subtree-dir: cwltool/schemas git-subtree-split: f9d95cbdc7b4f3c26d544d76067e6032f31c8e43
1 parent 5a7fc20 commit 03ca870

9 files changed

+184
-25
lines changed

v1.1.0-dev1/CommandLineTool.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ $graph:
198198
199199
- type: record
200200
name: CommandOutputBinding
201+
extends: LoadContents
201202
doc: |
202203
Describes how to generate an output parameter based on the files produced
203204
by a CommandLineTool.
@@ -224,15 +225,6 @@ $graph:
224225
return a string or an array of strings, which will then be evaluated as
225226
one or more glob patterns. Must only match and return files which
226227
actually exist.
227-
- name: loadContents
228-
type:
229-
- "null"
230-
- boolean
231-
jsonldPredicate: "cwl:loadContents"
232-
doc: |
233-
For each file matched in `glob`, read up to
234-
the first 64 KiB of text from the file and place it in the `contents`
235-
field of the file object for manipulation by `outputEval`.
236228
- name: outputEval
237229
type:
238230
- "null"
@@ -346,9 +338,6 @@ $graph:
346338
name: CommandInputParameter
347339
extends: InputParameter
348340
doc: An input parameter for a CommandLineTool.
349-
specialize:
350-
- specializeFrom: InputBinding
351-
specializeTo: CommandLineBinding
352341
fields:
353342
- name: type
354343
type:
@@ -373,6 +362,9 @@ $graph:
373362
typeDSL: True
374363
doc: |
375364
Specify valid types of data that may be assigned to this parameter.
365+
- name: inputBinding
366+
type: CommandLineBinding?
367+
jsonldPredicate: "cwl:inputBinding"
376368

377369
- type: record
378370
name: CommandOutputParameter

v1.1.0-dev1/Process.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,23 @@ $graph:
433433
jsonldPredicate: "@id"
434434
doc: "The unique identifier for this object."
435435

436+
437+
- name: LoadContents
438+
type: record
439+
abstract: true
440+
fields:
441+
- name: loadContents
442+
type:
443+
- "null"
444+
- boolean
445+
jsonldPredicate: "cwl:loadContents"
446+
doc: |
447+
Only valid when `type: File` or is an array of `items: File`.
448+
449+
Read up to the first 64 KiB of text from the file and place it in the
450+
"contents" field of the file object for use by expressions.
451+
452+
436453
- name: FieldBase
437454
type: record
438455
extends: Labeled
@@ -562,14 +579,18 @@ $graph:
562579
- boolean
563580
jsonldPredicate: "cwl:loadContents"
564581
doc: |
582+
Use of `loadContents` in `InputBinding` is deprecated.
583+
Preserved for v1.0 backwards compatability. May be removed in
584+
a future spec. Use `InputParameter.loadContents` instead.
585+
565586
Only valid when `type: File` or is an array of `items: File`.
566587
567588
Read up to the first 64 KiB of text from the file and place it in the
568589
"contents" field of the file object for use by expressions.
569590
570591
571592
- name: InputSchema
572-
extends: [Labeled, sld:Documented, BindsInput]
593+
extends: [Labeled, sld:Documented]
573594
type: record
574595
abstract: true
575596
fields:
@@ -584,18 +605,10 @@ $graph:
584605
type: record
585606
abstract: true
586607

587-
- name: BindsInput
588-
type: record
589-
abstract: true
590-
fields:
591-
- name: inputBinding
592-
type: InputBinding?
593-
jsonldPredicate: "cwl:inputBinding"
594-
595608

596609
- name: InputRecordField
597610
type: record
598-
extends: [sld:RecordField, FieldBase, BindsInput, InputFormat]
611+
extends: [sld:RecordField, FieldBase, InputFormat, LoadContents]
599612
specialize:
600613
- specializeFrom: "sld:RecordSchema"
601614
specializeTo: InputRecordSchema
@@ -681,9 +694,8 @@ $graph:
681694
- name: InputParameter
682695
type: record
683696
abstract: true
684-
extends: [Parameter, BindsInput, InputFormat]
697+
extends: [Parameter, InputFormat, LoadContents]
685698
fields:
686-
687699
- name: default
688700
type: Any?
689701
jsonldPredicate:

v1.1.0-dev1/Workflow.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ $graph:
118118
typeDSL: True
119119
doc: |
120120
Specify valid types of data that may be assigned to this parameter.
121+
- name: inputBinding
122+
type: InputBinding?
123+
doc: Deprecated. Preserved for v1.0 backwards compatability. Use `InputParameter.loadContents` instead.
124+
jsonldPredicate: "cwl:inputBinding"
125+
121126

122127
- type: record
123128
name: ExpressionTool
@@ -228,7 +233,7 @@ $graph:
228233
229234
- type: record
230235
name: WorkflowStepInput
231-
extends: [Identified, Sink]
236+
extends: [Identified, Sink, LoadContents]
232237
docParent: "#WorkflowStep"
233238
doc: |
234239
The input of a workflow step connects an upstream parameter (from the

v1.1.0-dev1/conformance_test_v1.1.0-dev1.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,3 +1686,35 @@
16861686
tool: v1.1.0-dev1/record-out-format.cwl
16871687
doc: Test format on output record fields
16881688
tags: [ required ]
1689+
1690+
- job: v1.1.0-dev1/wf-loadContents-job.yml
1691+
output: {
1692+
"my_int": 42
1693+
}
1694+
tool: v1.1.0-dev1/wf-loadContents.cwl
1695+
doc: Test WorkflowInputParameter.inputBinding.loadContents
1696+
tags: [ required ]
1697+
1698+
- job: v1.1.0-dev1/wf-loadContents-job.yml
1699+
output: {
1700+
"my_int": 42
1701+
}
1702+
tool: v1.1.0-dev1/wf-loadContents2.cwl
1703+
doc: Test WorkflowInputParameter.loadContents
1704+
tags: [ required ]
1705+
1706+
- job: v1.1.0-dev1/wf-loadContents-job.yml
1707+
output: {
1708+
"my_int": 42
1709+
}
1710+
tool: v1.1.0-dev1/wf-loadContents3.cwl
1711+
doc: Test loadContents on InputParameter.loadContents (expression)
1712+
tags: [ required ]
1713+
1714+
- job: v1.1.0-dev1/wf-loadContents-job.yml
1715+
output: {
1716+
"my_int": 42
1717+
}
1718+
tool: v1.1.0-dev1/wf-loadContents4.cwl
1719+
doc: Test WorkflowStepInput.loadContents
1720+
tags: [ required ]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
my_file:
2+
class: File
3+
location: answer
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
cwlVersion: v1.1.0-dev1
2+
class: Workflow
3+
requirements:
4+
StepInputExpressionRequirement: {}
5+
InlineJavascriptRequirement: {}
6+
inputs:
7+
my_file:
8+
type: File
9+
inputBinding:
10+
loadContents: true
11+
12+
steps:
13+
one:
14+
run:
15+
class: ExpressionTool
16+
requirements: { InlineJavascriptRequirement: {} }
17+
inputs: { my_number: int }
18+
outputs: { my_int: int }
19+
expression: |
20+
${ return { "my_int": inputs.my_number }; }
21+
in:
22+
my_number:
23+
source: my_file
24+
valueFrom: $(parseInt(self.contents))
25+
out: [ my_int ]
26+
27+
outputs:
28+
my_int:
29+
type: int
30+
outputSource: one/my_int
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cwlVersion: v1.1.0-dev1
2+
class: Workflow
3+
requirements:
4+
StepInputExpressionRequirement: {}
5+
InlineJavascriptRequirement: {}
6+
inputs:
7+
my_file:
8+
type: File
9+
loadContents: true
10+
11+
steps:
12+
one:
13+
run:
14+
class: ExpressionTool
15+
requirements: { InlineJavascriptRequirement: {} }
16+
inputs: { my_number: int }
17+
outputs: { my_int: int }
18+
expression: |
19+
${ return { "my_int": inputs.my_number }; }
20+
in:
21+
my_number:
22+
source: my_file
23+
valueFrom: $(parseInt(self.contents))
24+
out: [ my_int ]
25+
26+
outputs:
27+
my_int:
28+
type: int
29+
outputSource: one/my_int
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cwlVersion: v1.1.0-dev1
2+
class: Workflow
3+
requirements:
4+
StepInputExpressionRequirement: {}
5+
InlineJavascriptRequirement: {}
6+
inputs:
7+
my_file: File
8+
9+
steps:
10+
one:
11+
run:
12+
class: ExpressionTool
13+
requirements: { InlineJavascriptRequirement: {} }
14+
inputs:
15+
my_number:
16+
type: File
17+
loadContents: true
18+
outputs: { my_int: int }
19+
expression: |
20+
${ return { "my_int": parseInt(inputs.my_number.contents) }; }
21+
in:
22+
my_number: my_file
23+
out: [ my_int ]
24+
25+
outputs:
26+
my_int:
27+
type: int
28+
outputSource: one/my_int
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cwlVersion: v1.1.0-dev1
2+
class: Workflow
3+
requirements:
4+
StepInputExpressionRequirement: {}
5+
InlineJavascriptRequirement: {}
6+
inputs:
7+
my_file: File
8+
9+
steps:
10+
one:
11+
run:
12+
class: ExpressionTool
13+
requirements: { InlineJavascriptRequirement: {} }
14+
inputs: { my_number: int }
15+
outputs: { my_int: int }
16+
expression: |
17+
${ return { "my_int": inputs.my_number }; }
18+
in:
19+
my_number:
20+
source: my_file
21+
loadContents: true
22+
valueFrom: $(parseInt(self.contents))
23+
out: [ my_int ]
24+
25+
outputs:
26+
my_int:
27+
type: int
28+
outputSource: one/my_int

0 commit comments

Comments
 (0)