Skip to content

Commit 503c04b

Browse files
committed
add exclude_defaults arg
1 parent 70fb627 commit 503c04b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bioimageio/core/cli.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,18 @@ class UpdateFormatCmd(CmdBase, WithSource):
262262
263263
Updated bioimageio.yaml is rendered to the terminal if the output is None.
264264
"""
265-
# TODO: exclude default values (without braking discriminated unions)
266-
# exclude_defaults: bool = Field(True, alias="exclude-defaults")
267-
# """Exclude fields that have the default value."""
265+
266+
exclude_defaults: bool = Field(True, alias="exclude-defaults")
267+
"""Exclude fields that have the default value (even if set explicitly)."""
268268

269269
def run(self):
270-
updated = update_format(self.source, output=self.output)
270+
updated = update_format(
271+
self.source, output=self.output, exclude_defaults=self.exclude_defaults
272+
)
271273
updated_stream = StringIO()
272-
save_bioimageio_yaml_only(updated, updated_stream)
274+
save_bioimageio_yaml_only(
275+
updated, updated_stream, exclude_defaults=self.exclude_defaults
276+
)
273277
updated_md = f"```yaml\n{updated_stream.getvalue()}\n```"
274278

275279
rich_markdown = rich.markdown.Markdown(updated_md)

0 commit comments

Comments
 (0)