Skip to content

Commit

Permalink
fix loadContents for File[]
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Aug 26, 2024
1 parent 6d8c2a4 commit feeb0be
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cwltool/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def bind_input(
and "itemSeparator" not in binding
):
st["inputBinding"] = {}
for k in ("secondaryFiles", "format", "streamable"):
for k in ("secondaryFiles", "format", "streamable", "loadContents"):
if k in schema:
st[k] = schema[k]
if value_from_expression:
Expand Down Expand Up @@ -349,7 +349,7 @@ def bind_input(
"type": schema["items"],
"inputBinding": b2,
}
for k in ("secondaryFiles", "format", "streamable"):
for k in ("secondaryFiles", "format", "streamable", "loadContents"):
if k in schema:
itemschema[k] = schema[k]
bindings.extend(
Expand Down
1 change: 1 addition & 0 deletions tests/load_contents-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions tests/load_contents-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
24 changes: 24 additions & 0 deletions tests/load_contents-array.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cwlVersion: "v1.2"
class: CommandLineTool
baseCommand: echo
requirements:
InlineJavascriptRequirement: {}
inputs:
files:
type:
type: array
items: File
loadContents: true
inputBinding:
valueFrom: |
${
return JSON.stringify({
"data": inputs.files.map(item => parseInt(item.contents))
});
}
outputs:
out:
type: File
outputBinding:
glob: "data.json"
stdout: "data.json"
5 changes: 5 additions & 0 deletions tests/load_contents-array.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
files:
- class: File
path: load_contents-1.txt
- class: File
path: load_contents-2.txt

0 comments on commit feeb0be

Please sign in to comment.