Skip to content

Commit c61f6f5

Browse files
Added type patch on outputMethod == all
1 parent 4ec1874 commit c61f6f5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cwltool/checker.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def check_all_types(
386386
message="Source is from conditional step, but pickValue is not used",
387387
)
388388
)
389+
if is_all_output_method_loop_step(param_to_step, parm_id):
390+
src_dict[parm_id]['type'] = {'type': 'array', 'items': src_dict[parm_id]['type']}
389391
else:
390392
parm_id = cast(str, sink[sourceField])
391393
if parm_id not in src_dict:
@@ -427,6 +429,9 @@ def check_all_types(
427429

428430
srcs_of_sink[0]["type"] = src_typ
429431

432+
if is_all_output_method_loop_step(param_to_step, parm_id):
433+
src_dict[parm_id]['type'] = {'type': 'array', 'items': src_dict[parm_id]['type']}
434+
430435
for src in srcs_of_sink:
431436
check_result = check_types(src, sink, linkMerge, valueFrom)
432437
if check_result == "warning":
@@ -514,3 +519,16 @@ def is_conditional_step(param_to_step: Dict[str, CWLObjectType], parm_id: str) -
514519
if source_step.get("when") is not None:
515520
return True
516521
return False
522+
523+
524+
def is_all_output_method_loop_step(param_to_step: Dict[str, CWLObjectType], parm_id: str) -> bool:
525+
source_step = param_to_step.get(parm_id)
526+
if source_step is not None:
527+
requirements = {
528+
**{h['class']: h for h in source_step.get('hints', [])},
529+
**{r['class']: r for r in source_step.get('requirements', [])}}
530+
if 'http://commonwl.org/cwltool#Loop' in requirements:
531+
output_method = requirements['http://commonwl.org/cwltool#Loop'].get('outputMethod', 'last')
532+
if output_method == 'all':
533+
return True
534+
return False

0 commit comments

Comments
 (0)