@@ -216,17 +216,16 @@ def resolve_and_validate_document(loadingContext,
216
216
217
217
fileuri = urllib .parse .urldefrag (uri )[0 ]
218
218
219
- cwlVersion = workflowobj .get ("cwlVersion" )
219
+ cwlVersion = loadingContext . metadata .get ("cwlVersion" )
220
220
if not cwlVersion :
221
- fileobj = fetch_document (fileuri , loadingContext )[1 ]
222
- cwlVersion = fileobj .get ("cwlVersion" )
223
- if not cwlVersion :
224
- raise ValidationException (
225
- "No cwlVersion found. "
226
- "Use the following syntax in your CWL document to declare "
227
- "the version: cwlVersion: <version>.\n "
228
- "Note: if this is a CWL draft-2 (pre v1.0) document then it "
229
- "will need to be upgraded first." )
221
+ cwlVersion = workflowobj .get ("cwlVersion" )
222
+ if not cwlVersion :
223
+ raise ValidationException (
224
+ "No cwlVersion found. "
225
+ "Use the following syntax in your CWL document to declare "
226
+ "the version: cwlVersion: <version>.\n "
227
+ "Note: if this is a CWL draft-2 (pre v1.0) document then it "
228
+ "will need to be upgraded first." )
230
229
231
230
if not isinstance (cwlVersion , string_types ):
232
231
with SourceLine (workflowobj , "cwlVersion" , ValidationException ):
@@ -285,6 +284,8 @@ def resolve_and_validate_document(loadingContext,
285
284
workflowobj ["id" ] = fileuri
286
285
processobj , metadata = document_loader .resolve_all (
287
286
workflowobj , fileuri , checklinks = loadingContext .do_validate )
287
+ if loadingContext .metadata :
288
+ metadata = loadingContext .metadata
288
289
if not isinstance (processobj , (CommentedMap , CommentedSeq )):
289
290
raise ValidationException ("Workflow must be a CommentedMap or CommentedSeq." )
290
291
if not isinstance (metadata , CommentedMap ):
0 commit comments