Document validation caveats of the get_metadata methods#1892
Conversation
`RemoteDandiset.get_metadata` and `BaseRemoteAsset.get_metadata` validate the fetched metadata against the `Dandiset` and `Asset` models of the installed `dandischema`, not against the version of the model that the metadata was published under. Drift between the two can render previously-valid metadata invalid, so even a published version's metadata is not guaranteed to validate. Document that caveat, and document the `pydantic.ValidationError` that both methods can raise when the fetched metadata does not validate. Co-Authored-By: Claude Code 2.1.210 / Claude Opus 4.8 claude-opus-4-8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1892 +/- ##
==========================================
- Coverage 76.96% 76.93% -0.03%
==========================================
Files 88 88
Lines 12882 12882
==========================================
- Hits 9914 9911 -3
- Misses 2968 2971 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The failing CI checks here are unrelated to this docstring-only change.
Root cause of the
|
|
Follow-up: the |
Docstring-only change to
RemoteDandiset.get_metadata()andBaseRemoteAsset.get_metadata(). No behavior change.Both methods validate fetched metadata against the
Dandiset/Assetmodel of the installeddandischema, not against the version of that model the metadata was published under. The existing note only warns that unpublished versions may have invalid metadata, which leaves two things unstated:dandischemaand the version of the model the metadata was published under.pydantic.ValidationErrorwhen the fetched metadata does not validate againstdandischema.models.Dandiset/dandischema.models.Asset.Both are now documented, the latter as a
:raises:field matching the convention already used elsewhere indandiapi.py.Test plan
flake8andblack --checkclean ondandi/dandiapi.py