Skip to content

Commit d44d087

Browse files
authored
Merge pull request #165 from common-workflow-language/manabuishii-patch-3
About using hyphen as id
2 parents f23f6f4 + a0ed942 commit d44d087

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

_extras/miscellaneous.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,72 @@ outputs:
170170
type: File
171171
outputSource: first/txt
172172
```
173+
174+
### CWL Paramter Reference error due to hyphen in input identifier
175+
176+
If `cwltool --validate` returns valid
177+
178+
```console
179+
$ cwltool --validate cwl/qiime.cwl
180+
INFO /usr/local/bin/cwltool 1.0.20190831161204
181+
INFO Resolved 'cwl/qiime.cwl' to 'file:///workspace/cwl/qiime.cwl'
182+
cwl/qiime.cwl is valid CWL.
183+
```
184+
185+
But executing it causes an error like:
186+
187+
```console
188+
$ cwltool cwl/qiime.cwl --sample-input metadata.tsv
189+
INFO /usr/local/bin/cwltool 1.0.20190831161204
190+
INFO Resolved 'cwl/qiime.cwl' to 'file:///workspace/cwl/qiime.cwl'
191+
ERROR Workflow error, try again with --debug for more information:
192+
cwl/qiime.cwl:14:5: Expression evaluation error:
193+
Syntax error in parameter reference '(inputs.sample-input)'. This could be due
194+
to using Javascript code without specifying InlineJavascriptRequirement.
195+
```
196+
197+
The file is here
198+
199+
```cwl
200+
cwlVersion: v1.0
201+
class: CommandLineTool
202+
baseCommand: [qiime, metadata, tabulate]
203+
arguments:
204+
- prefix: --m-input-file
205+
valueFrom: $(inputs.sample-input)
206+
inputs:
207+
sample-input: File
208+
outputs: []
209+
```
210+
211+
Problem caused by `-` (hyphen charcter).
212+
213+
```cwl
214+
valueFrom: $(inputs.sample-input)
215+
# ^ this is problem
216+
...
217+
218+
inputs:
219+
sample-input: File
220+
# ^ this is problem
221+
```
222+
223+
224+
Fix this error is change `-` (hyphen) to `_` (underscore)
225+
226+
```cwl
227+
valueFrom: $(inputs.sample_input)
228+
# ^ changed here
229+
230+
...
231+
232+
inputs:
233+
sample_input: File
234+
# ^ changed here
235+
```
236+
237+
If is not possible to change the input identifier, then you can use an alternative CWL Parameter Reference syntax:
238+
239+
```cwl
240+
valueFrom: $(inputs["sample-input"])
241+
```

0 commit comments

Comments
 (0)