Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested parameter error message prints toplevel as map #80

Open
PikalaxALT opened this issue Dec 15, 2024 · 0 comments
Open

Nested parameter error message prints toplevel as map #80

PikalaxALT opened this issue Dec 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@PikalaxALT
Copy link

Below is a minimal illustrative example. In a larger case of nested parameter groups, the printed dict can be hundreds of columns wide and bury the true reason for the validation failure.

nextflow_schema.json:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/testpipeline/master/nextflow_schema.json",
    "title": "nf-core/testpipeline pipeline parameters",
    "description": "this is a test",
    "type": "object",
    "$defs": {
        "category": {
            "type": "object",
            "title": "An interesting title",
            "properties": {
                "foo": {
                    "type": "object",
                    "anyOf": [
                        {
                            "required": ["bar"],
                            "errorMessage": "--foo.bar or --foo.baz is required"
                        },
                        {
                            "required": ["baz"],
                            "errorMessage": "--foo.bar or --foo.baz is required"
                        }
                    ],
                    "properties": {
                        "bar": {
                            "type": "string"
                        },
                        "baz": {
                            "type": "string"
                        },
                        "boop": {
                            "type": "string",
                            "default": "banana"
                        }
                    }
                }
            }
        }
    },
    "allOf": [
        {
            "$ref": "#/$defs/category"
        }
    ]
}

nextflow.config

params {
    foo {
        bar = null
        baz = null
        boop = 'banana'
    }
}

validation {
    help {
        enabled = true
    }
}

main.nf

include { validateParameters } from 'plugin/nf-schema'

process SAY_HELLO {
    input:
    val object

    output:
    val "Hello $object"

    exec: null
}

workflow {
    validateParameters()
    Channel.of(
        'world',
        params.foo.bar ?: params.foo.baz,
        params.foo.boop,
        'General Kenobi'
    ) | SAY_HELLO | view
}

commandline: nextflow run .

response:


 N E X T F L O W   ~  version 24.10.2

Launching `./main.nf` [wise_edison] DSL2 - revision: bc7026d241

ERROR ~ Validation of pipeline parameters failed!

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

* --foo ({"boop":"banana"}): Missing required parameter(s): bar (--foo.bar or --foo.baz is required)
* --foo ({"boop":"banana"}): Missing required parameter(s): baz (--foo.bar or --foo.baz is required)
* --foo ({"boop":"banana"}): Value does not match against any of the schemas

 -- Check script 'main.nf' at line: 17 or see '.nextflow.log' file for more details
(nf-core) pikalaxalt@Mac nextflow_test % 
@nvnieuwk nvnieuwk added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants