Skip to content

Commit cc803b0

Browse files
committed
pack.py: add 'cwlVersion' in pack dict, if only single item exists
1 parent da4930f commit cc803b0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cwltool/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ def loadref(b, u):
655655
def print_pack(document_loader, processobj, uri, metadata):
656656
# type: (Loader, Union[Dict[Text, Any], List[Dict[Text, Any]]], Text, Dict[Text, Any]) -> str
657657
packed = pack(document_loader, processobj, uri, metadata)
658+
658659
if len(packed["$graph"]) > 1:
659660
return json.dumps(packed, indent=4)
660661
else:

cwltool/pack.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,9 @@ def rewrite_id(r, mainuri):
157157

158158
import_embed(packed, set())
159159

160+
if len(packed["$graph"]) == 1:
161+
# duplicate 'cwlVersion' inside $graph when there is a single item
162+
# because we're printing contents inside '$graph' rather than whole dict
163+
packed["$graph"][0]["cwlVersion"] = packed["cwlVersion"]
164+
160165
return packed

0 commit comments

Comments
 (0)