diff --git a/cwltool/schemas/v1.0/salad/schema_salad/metaschema/metaschema_base.yml b/cwltool/schemas/v1.0/salad/schema_salad/metaschema/metaschema_base.yml index d8bf0a3c3..454bff850 100644 --- a/cwltool/schemas/v1.0/salad/schema_salad/metaschema/metaschema_base.yml +++ b/cwltool/schemas/v1.0/salad/schema_salad/metaschema/metaschema_base.yml @@ -168,4 +168,5 @@ $graph: _id: "sld:items" _type: "@vocab" refScope: 2 + typeDSL: true doc: "Defines the type of the array elements." diff --git a/cwltool/schemas/v1.1/salad/schema_salad/metaschema/metaschema_base.yml b/cwltool/schemas/v1.1/salad/schema_salad/metaschema/metaschema_base.yml index 67008b683..4369bf85d 100644 --- a/cwltool/schemas/v1.1/salad/schema_salad/metaschema/metaschema_base.yml +++ b/cwltool/schemas/v1.1/salad/schema_salad/metaschema/metaschema_base.yml @@ -173,4 +173,5 @@ $graph: _id: "sld:items" _type: "@vocab" refScope: 2 + typeDSL: true doc: "Defines the type of the array elements." diff --git a/cwltool/schemas/v1.2/salad/schema_salad/metaschema/metaschema_base.yml b/cwltool/schemas/v1.2/salad/schema_salad/metaschema/metaschema_base.yml index 67008b683..4369bf85d 100644 --- a/cwltool/schemas/v1.2/salad/schema_salad/metaschema/metaschema_base.yml +++ b/cwltool/schemas/v1.2/salad/schema_salad/metaschema/metaschema_base.yml @@ -173,4 +173,5 @@ $graph: _id: "sld:items" _type: "@vocab" refScope: 2 + typeDSL: true doc: "Defines the type of the array elements." diff --git a/tests/test_examples.py b/tests/test_examples.py index d906902a8..7a9db3255 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1596,6 +1596,17 @@ def test_custom_type_in_step_process() -> None: assert err_code == 0 +@pytest.mark.parametrize("version", ["1_0", "1_1", "1_2"]) +def test_array_items_typedsl(version: str) -> None: + """Demonstrate that 'type: array, items: SomeType[]' works.""" + err_code, _, stderr = get_main_output( + [ + get_data(f"tests/wf/nested_typedsl_v{version}.cwl"), + get_data("tests/wf/nested_typedsl_job.yml"), + ] + ) + assert err_code == 0 + def test_expression_tool_class() -> None: """Confirm properties of the ExpressionTool class.""" factory = cwltool.factory.Factory() @@ -1617,4 +1628,4 @@ def test_command_line_tool_class() -> None: factory = cwltool.factory.Factory() tool_path = get_data("tests/echo.cwl") expression_tool = factory.make(tool_path).t - assert str(expression_tool) == f"CommandLineTool: file://{tool_path}" + assert str(expression_tool) == f"CommandLineTool: file://{tool_path}" \ No newline at end of file diff --git a/tests/wf/nested_typedsl_job.yml b/tests/wf/nested_typedsl_job.yml new file mode 100644 index 000000000..4c9c80a2b --- /dev/null +++ b/tests/wf/nested_typedsl_job.yml @@ -0,0 +1,5 @@ +cat_in: + - - class: File + location: echo.cwl + - class: File + location: cat.cwl diff --git a/tests/wf/nested_typedsl_v1_0.cwl b/tests/wf/nested_typedsl_v1_0.cwl new file mode 100755 index 000000000..460c977b1 --- /dev/null +++ b/tests/wf/nested_typedsl_v1_0.cwl @@ -0,0 +1,14 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.0 +class: CommandLineTool +baseCommand: cat +inputs: + cat_in: + type: + type: array + items: File[] + inputBinding: {} +stdout: all.txt +outputs: + txt: + type: stdout diff --git a/tests/wf/nested_typedsl_v1_1.cwl b/tests/wf/nested_typedsl_v1_1.cwl new file mode 100755 index 000000000..460c977b1 --- /dev/null +++ b/tests/wf/nested_typedsl_v1_1.cwl @@ -0,0 +1,14 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.0 +class: CommandLineTool +baseCommand: cat +inputs: + cat_in: + type: + type: array + items: File[] + inputBinding: {} +stdout: all.txt +outputs: + txt: + type: stdout diff --git a/tests/wf/nested_typedsl_v1_2.cwl b/tests/wf/nested_typedsl_v1_2.cwl new file mode 100755 index 000000000..460c977b1 --- /dev/null +++ b/tests/wf/nested_typedsl_v1_2.cwl @@ -0,0 +1,14 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.0 +class: CommandLineTool +baseCommand: cat +inputs: + cat_in: + type: + type: array + items: File[] + inputBinding: {} +stdout: all.txt +outputs: + txt: + type: stdout