nf-core / airrflow

B-cell and T-cell Adaptive Immune Receptor Repertoire (AIRR) sequencing analysis pipeline using the Immcantation framework
https://nf-co.re/airrflow
MIT License
46 stars 32 forks source link

Invalid nextflow_schema.json using list type. #292

Closed adamrtalbot closed 7 months ago

adamrtalbot commented 7 months ago

Description of the bug

The clonal_analysis_options in the nextflow_schema.json uses a list of types:

"properties": {
    "clonal_threshold": {
        "type": ["string", "number"],
        "default": "auto",
        "fa_icon": "fab fa-pagelines",
        "description": "Set the clustering threshold Hamming distance value. Default: 'auto'"
    },

It should be:

"properties": {
    "clonal_threshold": {
        "oneOf": [
            {
                "type": "string"
            },
            {
                "type": "number",

            }
        ],
        "default": "auto",
        "fa_icon": "fab fa-pagelines",
        "description": "Set the clustering threshold Hamming distance value. Default: 'auto'"
    },

This could also include validation like so:

"clonal_threshold": {
    "oneOf": [
        {
            "type": "string",
            "enum": [
                "auto"
            ]
        },
        {
            "type": "number",
            "minimum": 0
        }
    ],
    "default": "auto",
    "fa_icon": "fab fa-pagelines",
    "description": "Set the clustering threshold Hamming distance value. Default: 'auto'"
},

We can now have enhanced validation:

> nextflow run . -profile test,docker --outdir results --clonal_threshold -1
N E X T F L O W  ~  version 23.10.0
Launching `./main.nf` [special_jennings] DSL2 - revision: 65c2c54ef2
ERROR ~ ERROR: Validation of pipeline parameters failed!

 -- Check '.nextflow.log' file for details
The following invalid input values have been detected:

* --clonal_threshold: -1 is not a valid enum value (-1)
* --clonal_threshold: expected type: String, found: Integer (-1)
* --clonal_threshold: -1 is not greater or equal to 0 (-1)
> nextflow run . -profile test,docker --outdir results --clonal_threshold blegh
N E X T F L O W  ~  version 23.10.0
Launching `./main.nf` [gigantic_pike] DSL2 - revision: 65c2c54ef2
ERROR ~ ERROR: Validation of pipeline parameters failed!

 -- Check '.nextflow.log' file for details
The following invalid input values have been detected:

* --clonal_threshold: blegh is not a valid enum value (blegh)
* --clonal_threshold: expected type: Number, found: String (blegh)

Command used and terminal output

No response

Relevant files

nextflow_schema.json

System information

No response