48
48
overrides_ctx = {
49
49
u"overrideTarget" : {u"@type" : u"@id" },
50
50
u"cwltool" : "http://commonwl.org/cwltool#" ,
51
- u"overrides" : {
51
+ u"http://commonwl.org/cwltool# overrides" : {
52
52
"@id" : "cwltool:overrides" ,
53
53
"mapSubject" : "overrideTarget" ,
54
54
},
@@ -226,7 +226,7 @@ def validate_document(document_loader, # type: Loader
226
226
uri = urllib .parse .urljoin (uri , workflowobj ["https://w3id.org/cwl/cwl#tool" ])
227
227
del cast (dict , jobobj )["https://w3id.org/cwl/cwl#tool" ]
228
228
229
- if "http://commonwl.org/cwltool#overrides" in jobobj :
229
+ if isinstance ( jobobj , CommentedMap ) and "http://commonwl.org/cwltool#overrides" in jobobj :
230
230
overrides .extend (resolve_overrides (jobobj , uri , uri ))
231
231
del jobobj ["http://commonwl.org/cwltool#overrides" ]
232
232
@@ -272,7 +272,7 @@ def validate_document(document_loader, # type: Loader
272
272
if isinstance (avsc_names , Exception ):
273
273
raise avsc_names
274
274
275
- processobj = None # type: Union[CommentedMap, CommentedSeq, Text]
275
+ processobj = None # type: Union[CommentedMap, CommentedSeq, Text, None ]
276
276
document_loader = Loader (sch_document_loader .ctx , schemagraph = sch_document_loader .graph ,
277
277
idx = document_loader .idx , cache = sch_document_loader .cache ,
278
278
fetcher_constructor = fetcher_constructor , skip_schemas = skip_schemas )
@@ -285,7 +285,7 @@ def validate_document(document_loader, # type: Loader
285
285
if not isinstance (processobj , (CommentedMap , CommentedSeq )):
286
286
raise ValidationException ("Workflow must be a dict or list." )
287
287
288
- if not new_metadata :
288
+ if not new_metadata and isinstance ( processobj , CommentedMap ) :
289
289
new_metadata = cast (CommentedMap , cmap (
290
290
{"$namespaces" : processobj .get ("$namespaces" , {}),
291
291
"$schemas" : processobj .get ("$schemas" , []),
@@ -387,7 +387,7 @@ def resolve_overrides(ov, # Type: CommentedMap
387
387
raise Exception ("Expected CommentedMap, got %s" % type (ret ))
388
388
cwl_docloader = get_schema ("v1.0" )[0 ]
389
389
cwl_docloader .resolve_all (ret , ov_uri )
390
- return ret ["overrides" ]
390
+ return ret ["http://commonwl.org/cwltool# overrides" ]
391
391
392
392
def load_overrides (ov , base_url ): # type: (Text, Text) -> List[Dict[Text, Any]]
393
393
ovloader = Loader (overrides_ctx )
0 commit comments