From 2ee49d2a0b3ceda9650eaa1d7f74d7a6395176c4 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 9 Sep 2021 15:53:08 +0200 Subject: [PATCH] ArraySchema.items does need typeDSL after all --- .../schema_salad/metaschema/metaschema_base.yml | 1 + .../schema_salad/metaschema/metaschema_base.yml | 1 + .../schema_salad/metaschema/metaschema_base.yml | 1 + tests/test_examples.py | 12 ++++++++++++ tests/wf/nested_typedsl_job.yml | 5 +++++ tests/wf/nested_typedsl_v1_0.cwl | 14 ++++++++++++++ tests/wf/nested_typedsl_v1_1.cwl | 14 ++++++++++++++ tests/wf/nested_typedsl_v1_2.cwl | 14 ++++++++++++++ 8 files changed, 62 insertions(+) create mode 100644 tests/wf/nested_typedsl_job.yml create mode 100755 tests/wf/nested_typedsl_v1_0.cwl create mode 100755 tests/wf/nested_typedsl_v1_1.cwl create mode 100755 tests/wf/nested_typedsl_v1_2.cwl 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 c74cae4a1..1e1702b43 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1587,3 +1587,15 @@ 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 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