galaxyproject / galaxyproject/gxformat2
CWL export validation not as strict as cwltool's
- Dominant language
- Python
- Stars
- 14
- Forks
- 7
- Avg merge
- 2h 49m
- Merged PRs (30d)
- 8
Description
It was recently found that CWL abstract workflows generated with gxformat2 fail to validate with `cwltool --validate` (see https://github.com/ResearchObject/ro-crate-py/issues/33 for some background). However, [test_export_abstract.py](https://github.com/galaxyproject/gxformat2/blob/ffac886d3bacffe33d34497201f963320ac226c6/tests/test_export_abstract.py) succeeds, despite using `cwltool.main.resolve_and_validate_document`. The reason is that `cwltool --validate` does not stop after calling `resolve_and_validate_document`. In particular, [it calls `make_tool`](https://github.com/common-workflow-language/cwltool/blob/3.0.20201109103151/cwltool/main.py#L990), which tries to build a `Workflow` object and triggers [this validation error](https://github.com/common-workflow-language/cwltool/blob/0e8110083bad6ea98fc487aa262953a6c5e010b5/cwltool/workflow.py#L292).
To make the validation in the test as strict as `cwltool --validate`, the following change could be applied:
```diff
diff --git a/tests/test_export_abstract.py b/tests/test_export_abstract.py
index ae6c382..fe43171 100644
--- a/tests/test_export_abstract.py
+++ b/tests/test_export_abstract.py
@@ -11,6 +11,7 @@ from cwltool.main import (
resolve_and_validate_document,
tool_resolver,
)
+from cwltool.load_tool import make_tool
from gxformat2._yaml import ordered_dump, ordered_load
from gxformat2.abstract import CWL_VERSION, from_dict
@@ -130,6 +131,7 @@ def _run_example(as_dict, out="test.cwl"):
workflowobj,
uri,
)
+ make_tool(uri, loadingContext)
return abstract_as_dict
```
Contributor guide
Assessment
This issue has not been assessed yet.