Does `nextflow_schema.json` support arrays as inpu...
# help
l
Does
nextflow_schema.json
support arrays as input? I'm trying to get something along the lines of the following to work but keep getting linting errors:
Copy code
"somatic_var_keep": {
                    "type": "array",
                    "description": "List of somatic variant callers to use. Must include at least one of [deepsomatic, clair].",
                    "items": {
                        "type": "string",
                        "enum": ["deepsomatic", "clair"]
                    },
                    "minItems": 1,
                    "default": "['deepsomatic', 'clair']"
                }
Feel like I've tried all possible variations. But maybe it just doesnt support arrays? 😅
a
This works for me
Copy code
"fastq_read1": {
      "type": ["string", "array"],
      "items": {
        "type": "string",
        "format": "file-path",
        "exists": true
      },
      "default": "[]",
      "format": "file-path"
    },
👀 1
i
In case it helps, the usual way to handle params with multiple options is to set it to
string
and use
.split()
to convert it into a list inside the workflow, and then validate it as required. It would be interesting to see a pure nf-schema solution though.
l
It at least passes linting now, lets see if it works in the actual test profile as well quick look
Looks like it works. Thanks a bunch @Alec Wysoker
👍 1
e
This works for me as well (same formatting as above)
Copy code
"genome_accessions": {
                "type": "array",
                "items": { "type": "string" },
                "hidden": true,
                "description": "Genome accessions"
            },
a
Yes the schema should support arrays. But they are kind of meaningless unless you supply your params via a
-params-file
because there is no support for array params on the cli
The example from Alec I expect returns a string when only one item is passed - which may or may not be what you want. The example from Erin should always result in an array, even when it only has one element.