dandi / dandi/dandi-schema

Remove the deprecated `PublishedDandiset` / `PublishedAsset` aliases

Open
#440 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7
Forks
15
PR merge metrics
No merged PRs in 30d

Description

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:

```python
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 #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:196` — `validate(..., 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with dandischema/models.py, the in-repo uses in to_datacite and tests, and SCHEMA_MAP; then inspect the listed dandi-archive call sites and dandischema/metadata.py validation lookups. Remove deprecated alias usage without breaking publication validation, decide how historical SCHEMA_MAP keys should behave, and update the affected tests and consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.