Skip to content

Cast the command line values of nested parameters - #234

Merged
pinin4fjords merged 3 commits into
nextflow-io:masterfrom
pinin4fjords:fix/nested-cli-cast
Oct 5, 2026
Merged

pinin4fjords merged 3 commits into
nextflow-io:masterfrom
pinin4fjords:fix/nested-cli-cast

Conversation

@pinin4fjords

@pinin4fjords pinin4fjords commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #233

Use case

Nested parameters are how a pipeline that includes another pipeline (nextflow-io/nextflow#7213, ADR) passes the parameters of the included one, for example --rnaseq.skip_qc true. The same applies to any nested parameter given on the command line.

What changes

The String values given on the command line are cast to the type they have (true to a boolean, 3 to an integer, and so on) before validation. A value is cast when it is found in session.cliParams at the same place as in the params: the nested values of a nested parameter are found in the nested maps of session.cliParams (--group.flag true is [group: [flag: 'true']]). Values that were not given on the command line are not cast.

The cast is the new Types.castCliValues(), applied to the params before they are converted to JSON. It takes the place of the Map converter, which compared the keys of every nested map with the top-level keys of session.cliParams, so a nested value was never cast, and a nested key with the same name as a top-level command line parameter was.

Tests

  • TypesTest: boolean, integer, float and String values, values not given on the command line, nested values at several levels, and a nested key with the name of a top-level parameter
  • ValidateCliParamsTest (with a mocked Session): a nested value given on the command line is cast and accepted, one that is not of the type is rejected, and a nested String that was not given on the command line is not cast

Also checked end to end with a plugin built from this branch on a Nextflow master build, with the reproducer in #233: --group.flag true and --group.count 3 pass, and --group.flag maybe and --group.count abc are reported.

Related

#230 (Channel and Value params) is an independent fix for the same kind of pipeline. Its CHANGELOG entry is in the same section, and it edits the same part of ParameterValidator.groovy (the Map converter that casts the command line values), so the second of the two to merge needs a rebase.

The cast only looked for the keys of the top-level command line parameters, so
the value of a nested parameter (--group.flag true) stayed a String and failed
validation against a boolean or number. The nested values of the command line
parameters are now followed to find the values to cast.

Fixes nextflow-io#233

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@nvnieuwk nvnieuwk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment :p

Comment thread src/main/groovy/nextflow/validation/utils/Types.groovy
pinin4fjords and others added 2 commits October 2, 2026 15:15
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… params

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@nvnieuwk nvnieuwk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@pinin4fjords
pinin4fjords merged commit 4bf82c3 into nextflow-io:master Oct 5, 2026
5 checks passed
@pinin4fjords

Copy link
Copy Markdown
Contributor Author

Thanks @nvnieuwk !

pinin4fjords added a commit to pinin4fjords/nf-schema that referenced this pull request Oct 5, 2026
Upstream casts the command line values in a pass before the JSON generator
(nextflow-io#234), so the dataflow params are replaced in a pass just before it rather
than in the Map converter. A dataflow param given on the command line is
then cast like any other.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pinin4fjords
pinin4fjords deleted the fix/nested-cli-cast branch October 5, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command line values of nested parameters are not cast to the type in the schema

2 participants