Skip to content

Commit 3c7a871

Browse files
committed
load_tool.py: Raise validation exception when unsupported CWL Version is used
1 parent ce888a1 commit 3c7a871

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cwltool/load_tool.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from . import process, update
2323
from .errors import WorkflowException
2424
from .process import Process, shortname
25+
from .update import ALLUPDATES
2526

2627
_logger = logging.getLogger("cwltool")
2728

@@ -161,6 +162,11 @@ def validate_document(document_loader, # type: Loader
161162
if "cwlVersion" in workflowobj:
162163
if not isinstance(workflowobj["cwlVersion"], (str, Text)):
163164
raise Exception("'cwlVersion' must be a string, got %s" % type(workflowobj["cwlVersion"]))
165+
if workflowobj["cwlVersion"] not in list(ALLUPDATES):
166+
# print out all the Supported Versions of cwlVersion
167+
versions = list(ALLUPDATES) # ALLUPDATES is a dict
168+
versions.sort()
169+
raise ValidationException("'cwlVersion' not valid. Supported CWL versions are: \n{}".format("\n".join(versions)))
164170
workflowobj["cwlVersion"] = re.sub(
165171
r"^(?:cwl:|https://w3id.org/cwl/cwl#)", "",
166172
workflowobj["cwlVersion"])

0 commit comments

Comments
 (0)