Skip to content

De/re-vendorize dandi-archive #2382

@yarikoptic

Description

@yarikoptic

Work is ongoing in dandi-schema:PR#294 to make vendorization of the schema configurable.
That would result in dandi/schema JSONSchema serializations becoming generally de-vendorized.
And it will be dandi-archive instance responsibility to re-vendorize, which would primarily consist in changing regular expressions more restrictive, via configuration/environment-variables.

ATM we still have some hardcoded vendorization in dandi-archive code:

Backend

Excluding some where we might want to vendorize too (e.g. email subjects etc):

❯ git grep DANDI: -- dandiapi | grep -v -e test_ -e 'subject=' -e 'verbose_name'
dandiapi/api/models/version.py:            'identifier': f'DANDI:{self.dandiset.identifier}',
dandiapi/api/models/version.py:            'id': f'DANDI:{self.dandiset.identifier}/{self.version}',
dandiapi/api/services/metadata/__init__.py:            f'DANDI:{publishable_version.dandiset.identifier}/{publishable_version.version}'
dandiapi/api/tests/fuzzy.py:DANDISET_SCHEMA_ID_RE = Re(r'DANDI:\d{6}')
dandiapi/api/views/dandiset.py:            if identifier.startswith('DANDI:'):

Web frontend

❯ git grep DANDI: -- web | grep -v -e test_ -e 'subject=' -e 'verbose_name'
web/src/components/DandisetList.vue:        DANDI:<b>{{ item.dandiset.identifier }}</b>
web/src/stores/dandiset.ts:      schema['properties']['identifier']['pattern'] = '^DANDI:\\d{6}$'
web/src/views/DandisetLandingView/DownloadDialog.vue:  // Use the special 'DANDI:' url prefix if appropriate.
web/src/views/DandisetLandingView/DownloadDialog.vue:  const dandiUrl = `DANDI:${identifier}`;

Should rely on information to come from API, hence:

It is worth going one by one and seeing where/how to adjust. E.g. this one would require input from @mvandenburgh since not sufficient information provided in change introduced in 433e351 (I think vue3 migration, could be wrong)

❯ git blame web/src/stores/dandiset.ts | grep -A2 TODO
433e351f4 (Mike VanDenburgh 2025-02-05 13:45:34 -0500 119)       // TODO: Fix this upstream in the schema
1f52c6445 (Mike VanDenburgh 2025-03-05 14:38:35 -0500 120)       // @ts-expect-error TS7053
433e351f4 (Mike VanDenburgh 2025-02-05 13:45:34 -0500 121)       schema['properties']['identifier']['pattern'] = '^DANDI:\\d{6}$'

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions