File tree Expand file tree Collapse file tree 3 files changed +62
-0
lines changed
main/java/org/commonwl/view/cwl
java/org/commonwl/view/cwl Expand file tree Collapse file tree 3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -957,6 +957,14 @@ private String stepIDFromSource(String source) {
957957 private String extractDoc (Map <String , Object > cwlFile ) {
958958 if (cwlFile != null ) {
959959 if (cwlFile .containsKey (DOC )) {
960+ Object doc = cwlFile .get (DOC );
961+ if (doc .getClass ().isAssignableFrom (String .class )) {
962+ return (String ) doc ;
963+ }
964+ if (doc instanceof List <?>) {
965+ List <String > docList = (List <String >) doc ;
966+ return String .join ("" , docList );
967+ }
960968 return (String ) cwlFile .get (DOC );
961969 } else if (cwlFile .containsKey (DESCRIPTION )) {
962970 // This is to support older standards of cwl which use description instead of
Original file line number Diff line number Diff line change @@ -263,6 +263,23 @@ public void getHelloWorkflowOverview() throws Exception {
263263
264264 }
265265
266+ /**
267+ * Test retrieval of a workflow overview with an array ``doc`` field
268+ */
269+ @ Test
270+ public void getHelloWorkflowOverviewDocList () throws Exception {
271+
272+ // Test cwl service
273+ CWLService cwlService = new CWLService (Mockito .mock (RDFService .class ), Mockito .mock (CWLTool .class ), 5242880 );
274+
275+ // Run workflow overview
276+ File helloWorkflow = new File ("src/test/resources/cwl/hello/hello_doclist.cwl" );
277+ WorkflowOverview hello = cwlService .getWorkflowOverview (helloWorkflow );
278+ assertNotNull (hello );
279+ assertEquals ("Puts a message into a file using echo. Even more doc" , hello .getDoc ());
280+
281+ }
282+
266283 /**
267284 * Test IOException is thrown when files are over limit with getWorkflowOverview
268285 */
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env cwl-runner
2+
3+ cwlVersion: v1.0
4+ $graph:
5+ - id : echocmd
6+ class: CommandLineTool
7+ inputs :
8+ echo-in :
9+ type : string
10+ label : "Message"
11+ doc : "The message to print"
12+ default : "Hello World"
13+ inputBinding : {}
14+ outputs :
15+ echo-out :
16+ type : stdout
17+ label : "Printed Message"
18+ doc : "The file containing the message"
19+ baseCommand : echo
20+ stdout : messageout.txt
21+
22+ - id : main
23+ class: Workflow
24+ label : "Hello World"
25+ doc :
26+ - "Puts a message into a file using echo. "
27+ - "Even more doc"
28+ inputs : []
29+ outputs :
30+ output:
31+ type : File
32+ outputSource : step0/echo-out
33+ steps :
34+ step0:
35+ run : "#echocmd"
36+ in : []
37+ out : [echo-out]
You can’t perform that action at this time.
0 commit comments