Skip to content

Commit

Permalink
Schema - don't make default null for null values.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed May 12, 2021
1 parent cf9263c commit 47c7a99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* Fixed a bug in the Docker image build for tools that failed due to an extra hyphen. [[#1069](https://github.com/nf-core/tools/pull/1069)]
* Regular release sync fix - this time it was to do with JSON serialisation [[#1072](https://github.com/nf-core/tools/pull/1072)]

#### Sync

* Don't set the default value to `"null"` when a parameter is initialised as `null` in the config [[#1074](https://github.com/nf-core/tools/pull/1074)]

## [v1.14 - Brass Chicken :chicken:](https://github.com/nf-core/tools/releases/tag/1.14) - [2021-05-11]

### Template
Expand Down
6 changes: 5 additions & 1 deletion nf_core/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ def build_schema_param(self, p_val):
except ValueError:
p_type = "string"

# Anything can be "null", means that it is not set
if p_val == "null":
p_val = None

# NB: Only test "True" for booleans, as it is very common to initialise
# an empty param as false when really we expect a string at a later date..
if p_val == "True":
Expand All @@ -535,7 +539,7 @@ def build_schema_param(self, p_val):
p_schema = {"type": p_type, "default": p_val}

# Assume that false and empty strings shouldn't be a default
if p_val == "false" or p_val == "":
if p_val == "false" or p_val == "" or p_val is None:
del p_schema["default"]

return p_schema
Expand Down

0 comments on commit 47c7a99

Please sign in to comment.