8000 fix(schema): handle nullable and union types in `sanitise_param_default` by Lukecele · Pull Request #4637 · nf-core/tools · GitHub
[go: up one dir, main page]

Skip to content

fix(schema): handle nullable and union types in sanitise_param_default - #4637

Closed
Lukecele wants to merge 1 commit into
nf-core:devfrom
Lukecele:fix/nullable-param-default
Closed

Lukecele wants to merge 1 commit into
nf-core:devfrom
Lukecele:fix/nullable-param-default

Conversation

@Lukecele
Copy link
Copy Markdown

Fixes #4636.

Description

PipelineSchema.sanitise_param_default() and validate_config_default_parameter() compared param["type"] strictly against scalar strings ("number", "integer", "boolean", "string"). When a parameter uses a JSON Schema nullable/union type such as ["number", "null"], the numeric default fell through to str(param["default"]) and failed JSON Schema validation during nf-core pipelines lint.

Changes

  • Normalise param["type"] to a list and inspect non-null types in sanitise_param_default() and validate_config_default_parameter().
  • Preserve None defaults when "null" is an allowed type, and avoid stringifying already-typed defaults for multi-type unions.
  • Added unit tests in tests/pipelines/test_schema.py.

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!

@Lukecele
Lukecele requested a review from a team as a code owner November 24, 2026 06:06
@Lukecele
Lukecele force-pushed the fix/nullable-param-default branch from f570d35 to d41dbb9 Compare November 24, 2026 06:07
@codecov
codecov Bot commented Nov 24, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.00%. Comparing base (8d7aa93) to head (d41dbb9).

Files with missing lines Patch % Lines
nf_core/pipelines/schema.py 90.90% 2 Missing ⚠️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mashehu
mashehu commented Nov 25, 2026
Copy link
Copy Markdown
Member

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