Repository navigation
Conversation
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
Member
|
thanks for your contribution, but this was already fixed in a more global way in #4638 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4636.
sanitise_param_default()comparedparam["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 of400became"400"andnf-core pipelines lint --key schema_lintthen 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 anulldefault 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
CHANGELOG.mdis updateddocsis updated (not needed, no user-facing option changed)Tests:
test_sanitise_param_default_nullable_typesandtest_validate_defaults_nullable_numberfail ondevand pass with this change. I couldn't run the fulltest_schema.pylocally because itssetUpneeds Nextflow, so CI will be the full check there.ruff checkandruff format --checkpass.