Skip to content

Commit

Permalink
fix: handle the situation that metadata doesn't have `"assetsSummary"…
Browse files Browse the repository at this point in the history
…` field
  • Loading branch information
candleindark committed Feb 6, 2025
1 parent 8bbfa8a commit d0baff5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dandischema/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,10 @@ def migrate(
val["schemaKey"] = "AccessRequirements"
for resource in obj_migrated.get("relatedResource", []):
resource["schemaKey"] = "Resource"
if "schemaKey" not in obj_migrated["assetsSummary"]:
if (
"assetsSummary" in obj_migrated
and "schemaKey" not in obj_migrated["assetsSummary"]
):
obj_migrated["assetsSummary"]["schemaKey"] = "AssetsSummary"
if "schemaKey" not in obj_migrated:
obj_migrated["schemaKey"] = "Dandiset"

Check warning on line 387 in dandischema/metadata.py

View check run for this annotation

Codecov / codecov/patch

dandischema/metadata.py#L387

Added line #L387 was not covered by tests
Expand Down

0 comments on commit d0baff5

Please sign in to comment.