# How to specify that at least one of a group of parameters is necessary

**URL:** <https://cwl.discourse.group/t/how-to-specify-that-at-least-one-of-a-group-of-parameters-is-necessary/211>\
**Category:** CWL Questions\
**Created:** [October 5, 2020, 6:32pm UTC](https://cwl.discourse.group/t/how-to-specify-that-at-least-one-of-a-group-of-parameters-is-necessary/211 "2020-10-05T18:32:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pvanheus](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/pvanheus/32/33_2.png) [@pvanheus](https://cwl.discourse.group/u/pvanheus)\
**Post date:** [October 5, 2020, 6:32pm UTC](https://cwl.discourse.group/t/how-to-specify-that-at-least-one-of-a-group-of-parameters-is-necessary/211/1 "2020-10-05T18:32:23Z")

</div>

I am working on a CommandLineTool for [nextclade](https://github.com/common-workflow-library/bio-cwl-tools/pull/101). This tool can produce a number of outputs and while each one of the 5 possible outputs is optional, at least one of the options should be selected (otherwise there is not much point running the tool). Is there a way to express this in CWL?

Here is the set of parameters for which at least one needs to be chosen:

```auto
  output_json_filename:
    type: string?
    doc: Filename of output JSON results file
    inputBinding:
      prefix: --output-json
  output_csv_filename:
    type: string?
    doc: Filename of output CSV results file
    inputBinding:
      prefix: --output-csv
  output_tsv_filename:
    type: string?
    doc: Filename of output TSV results file
    inputBinding:
      prefix: --output-tsv
  output_tsv_clades_only_filename:
    type: string?
    doc: Filename to output CSV clades-only file
    inputBinding:
      prefix: --output-tsv-clades-only
  output_tree_filename:
    type: string?
    doc: Filename of output Auspice v2 tree file
    inputBinding:
      prefix: --output-tree

```

---

<div class="post-metadata">

**Author:** ![pvanheus](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/pvanheus/32/33_2.png) [@pvanheus](https://cwl.discourse.group/u/pvanheus)\
**Post date:** [October 5, 2020, 7:17pm UTC](https://cwl.discourse.group/t/how-to-specify-that-at-least-one-of-a-group-of-parameters-is-necessary/211/2 "2020-10-05T19:17:58Z")

</div>

I’ve solved this like this, where an `output_options` record is required but all the fields are (individually) optional.

```auto
  output_options:
    type:
      type: record
      name: output_options_record
      fields:
        output_json_filename:
          type: string?
          doc: Filename of output JSON results file
          inputBinding:
            prefix: --output-json
        output_csv_filename:
          type: string?
          doc: Filename of output CSV results file
          inputBinding:
            prefix: --output-csv
        output_tsv_filename:
          type: string?
          doc: Filename of output TSV results file
          inputBinding:
            prefix: --output-tsv
        output_tsv_clades_only_filename:
          type: string?
          doc: Filename to output CSV clades-only file
          inputBinding:
            prefix: --output-tsv-clades-only
        output_tree_filename:
          type: string?
          doc: Filename of output Auspice v2 tree file
          inputBinding:
            prefix: --output-tree

```
