Skip to content

Commit

Permalink
validate tree provided to WeldxFile
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Nov 19, 2024
1 parent f174390 commit 9daf287
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions weldx/asdf/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ def _write_tree(
# 2. file exists, but should be updated with new tree
if created:
asdf_file = asdf.AsdfFile(tree=tree, **asdffile_kwargs)
if asdf.__version__ >= "4.0.0":
# Starting in asdf 4 passing a tree to AsdfFile will
# not automatically validate the tree. For those versions
# we call validate here to check the tree.
asdf_file.validate()

Check warning on line 393 in weldx/asdf/file.py

View check run for this annotation

Codecov / codecov/patch

weldx/asdf/file.py#L393

Added line #L393 was not covered by tests
with self._config_context():
asdf_file.write_to(filename_or_path_like, **write_kwargs)
# Now set the file handle to the newly created AsdfFile instance.
Expand Down

0 comments on commit 9daf287

Please sign in to comment.