I am trying to write a tool where a record describes one of the inputs and the input itself is optional but if it is there then all parts of the input (all fields in the record) must be there. Here is a non-working example:
- type: record
- name: one
- name: two
This example does not work because
one.two are required arguments. What I intend to express is that
one is optional but if it is there then
one.two are required. If I make the fields optional (i.e. type
string?) then each of them can be provided or not, independently. That is also not correct.
I hope my question is clear.
This sounds like a hole in the spec/implementation. As a developer I would interpret this code exactly as your use case. I would request you open an issue on the CWL website. Currently we have different websites for different versions: the best would likely be open it on the main one (https://github.com/common-workflow-language/common-workflow-language)
Hey Peter, nice to see you here.
This appears to be a bug with the CWL reference runner, so please file an issue at https://github.com/common-workflow-language/cwltool
Specifically, it works with a YAML/JSON input object, but not via the
cwltool command line specification trick:
$ cat optional-record.yaml
$ cwltool optional_record.cwl optional-record.yaml
INFO /home/michael/user_guide/env2.7/bin/cwltool 1.0.20191022103248
INFO Resolved 'optional_record.cwl' to 'file:///home/michael/cwltool/optional_record.cwl'
INFO [job optional_record.cwl] /tmp/8mcr3z$ echo > /tmp/8mcr3z/output.txt
INFO [job optional_record.cwl] completed success
INFO Final process status is success