Skip to content

schema build: keep 0 and 0.0 defaults from the config - #4620

Merged
rpinho merged 4 commits into
nf-core:devfrom
rpinho:fix-schema-zero-defaults
Nov 18, 2026
Merged

rpinho merged 4 commits into
nf-core:devfrom
rpinho:fix-schema-zero-defaults

Conversation

@rpinho

@rpinho rpinho commented Nov 16, 2026

Copy link
Copy Markdown

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

There's a bug in add_schema_found_configs: it checks the config value's truthiness before adding a missing default, so 0 and 0.0 are dropped.

With params.threshold = 0 and a schema property {"type": "integer"}, nf-core pipelines schema build leaves the default out. It should write {"type": "integer", "default": 0}.

This checks for None instead. 0 and 0.0 are kept; false, null and empty strings are still left out, as before.

Test: tests/pipelines/test_schema_zero_defaults.py fails on dev for 0 and 0.0 and passes here; with tests/pipelines/test_schema.py that is 63 passed (Nextflow 25.10.4). The pre-commit hooks pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

rpinho added a commit to rpinho/tools that referenced this pull request Nov 16, 2026
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.82%. Comparing base (87c2710) to head (3d264f1).

☔ 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.

Comment thread docs/api/_src/api/pipelines/schema.md Outdated
Comment on lines +3 to +5
When schema build adds a missing default to an existing parameter, numeric zero
(`0` or `0.0`) is retained. False, null and empty-string config values do not add a schema default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
When schema build adds a missing default to an existing parameter, numeric zero
(`0` or `0.0`) is retained. False, null and empty-string config values do not add a schema default.

these sections are just for autogenerated docs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks.

@nf-core nf-core deleted a comment from codspeed Bot Nov 18, 2026

@mashehu mashehu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for the fix. I moved the tests to the rest of them and added one to make sure some false-y defaults stay out of the schema

@mashehu
mashehu force-pushed the fix-schema-zero-defaults branch from f025e14 to 3d264f1 Compare November 18, 2026 15:12
@nf-core nf-core deleted a comment from codspeed Bot Nov 18, 2026
@mashehu

mashehu commented Nov 18, 2026

Copy link
Copy Markdown
Member

feel free to merge whenever you are happy with the changes

@rpinho
rpinho merged commit 41500d7 into nf-core:dev Nov 18, 2026
125 checks passed
@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Author

Thanks! We would be glad to help in any way we can. What would be helpful for you? What's a hard problem?

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