Skip to content

Remove the deprecated PublishedDandiset / PublishedAsset aliases #440

Description

@candleindark

Follow-up from #419, which consolidated PublishedDandiset into Dandiset and PublishedAsset into Asset but kept the old names in dandischema/models.py as deprecated aliases so that consumers would keep importing successfully:

PublishedDandiset = Dandiset
PublishedAsset = Asset

Getting rid of them takes, in order:

  • Remove the use of the aliases in the consumers, e.g. dandi-archive.
  • Remove the aliases from dandischema/models.py, together with the remaining in-repo uses in to_datacite and the tests.
  • Decide what becomes of the PublishedDandiset / PublishedAsset keys of SCHEMA_MAP, since publish_model_schemata resolves each key with getattr(models, class_).
  • Remove the copies in models_importstab.py on the linkml-conversion branch (tracked separately in Remove the temporary Published* aliases from models_importstab.py #439).
Findings as of filing (recheck before implementing)

dandi-cli is clear. Verified at e982b3bc: it uses BareAsset, which stays, but neither deprecated alias.

dandi-archive uses both, in four places. api/views/schema.py and api/tests/test_schema.py are the two #419 called out: each builds its mapping from model.__name__, so both already collapse from four entries to two silently rather than failing.

The other two are load-bearing and fail at call time rather than at import, because they pass the name as a string:

  • dandiapi/api/services/publish/__init__.py:196validate(..., schema_key='PublishedDandiset', json_validation=True)
  • dandiapi/api/services/metadata/__init__.py:65,151 — the same with 'PublishedAsset' and 'PublishedDandiset'

validate resolves the key with getattr(models, schema_key) (dandischema/metadata.py:234 and :296), and both call sites sit on the publish path, so the breakage would surface at publication rather than at startup.

The SCHEMA_MAP question. Since #419 the published-*.json files have been byte-identical to dandiset.json and asset.json, so emitting them buys nothing, and the linkml-conversion branch has already stopped generating them on the LinkML side (7ed984e9). But SCHEMA_MAP is also the accepted schema_key vocabulary, and _get_jsonschema_validator builds a URL into a released schema version from it, so dropping the keys outright would also drop the ability to validate older published metadata under its historical key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions