8000 Keep numeric defaults for nullable schema param types by kadnaoui · Pull Request #4639 · nf-core/tools · GitHub
[go: up one dir, main page]

Skip to content

Keep numeric defaults for nullable schema param types - #4639

Closed
kadnaoui wants to merge 2 commits into
nf-core:devfrom
kadnaoui:fix/nullable-number-default
Closed

kadnaoui wants to merge 2 commits into
nf-core:devfrom
kadnaoui:fix/nullable-number-default

Conversation

@kadnaoui
Copy link
Copy Markdown

Fixes #4636.

sanitise_param_default() compared param["type"] against a single type name, so a nullable type like ["number", "null"] never matched "number" and fell through to the string branch. A default of 400 became "400" and nf-core pipelines lint --key schema_lint then failed with '400' is not of type 'number', 'null'.

Now a [<type>, "null"] union is sanitised like its non-null type (works for integer, number and boolean too), and a null default on a nullable type is left alone. Unions of two or more real types still fall through to the string handling as before.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated (not needed, no user-facing option changed)

Tests: test_sanitise_param_default_nullable_types and test_validate_defaults_nullable_number fail on dev and pass with this change. I couldn't run the full test_schema.py locally because its setUp needs Nextflow, so CI will be the full check there. ruff check and ruff format --check pass.

sanitise_param_default compared param["type"] with a single type name,
so a nullable type such as ["number", "null"] fell through to the
string branch and a default of 400 became "400". Lint then rejected it
with "'400' is not of type 'number', 'null'".

Sanitise a [<type>, "null"] union like its non-null type and leave a
null default alone.

Fixes nf-core#4636
@kadnaoui
kadnaoui requested a review from a team as a code owner November 24, 2026 23:01
@mashehu
mashehu commented Nov 25, 2026
Copy link
Copy Markdown
Member

thanks for your contribution, but this was already fixed in a more global way in #4638

@mashehu mashehu closed this Nov 25, 2026
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.

2 participants

0