Skip to content

Commit

Permalink
Merge pull request #1398 from dandi/gh-1363
Browse files Browse the repository at this point in the history
Add notes to docs about `get_metadata()` vs. `get_raw_metadata()`
  • Loading branch information
yarikoptic authored Feb 1, 2024
2 parents 96c3953 + 9e521e3 commit 98f5cf7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dandi/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,12 @@ def get_metadata(self) -> models.Dandiset:
"""
Fetch the metadata for this version of the Dandiset as a
`dandischema.models.Dandiset` instance
.. note::
Only published Dandiset versions can be expected to have valid
metadata. Consider using `get_raw_metadata()` instead in order to
fetch unstructured, possibly-invalid metadata.
"""
return models.Dandiset.parse_obj(self.get_raw_metadata())

Expand Down Expand Up @@ -1347,6 +1353,12 @@ def get_metadata(self) -> models.Asset:
"""
Fetch the metadata for the asset as a `dandischema.models.Asset`
instance
.. note::
Only assets in published Dandiset versions can be expected to have
valid metadata. Consider using `get_raw_metadata()` instead in
order to fetch unstructured, possibly-invalid metadata.
"""
return models.Asset.parse_obj(self.get_raw_metadata())

Expand Down

0 comments on commit 98f5cf7

Please sign in to comment.