Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boost dandischema to 0.9.* series so we get support for pydantic 2.0 and schema 0.6.5 #1823

Merged
merged 7 commits into from
Feb 21, 2024
4 changes: 3 additions & 1 deletion dandiapi/api/services/version/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ def _normalize_version_metadata(
}
# Run the version_metadata through the pydantic model to automatically include any boilerplate
# like the access or repository fields
return PydanticDandiset.unvalidated(**version_metadata).json_dict()
return PydanticDandiset.model_construct(**version_metadata).model_dump(
mode='json', exclude_none=True
)
5 changes: 3 additions & 2 deletions dandiapi/api/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_validate_asset_metadata_no_digest(draft_asset: Asset):

assert draft_asset.status == Asset.Status.INVALID
assert draft_asset.validation_errors == [
{'field': 'digest', 'message': 'A non-zarr asset must have a sha2_256.'}
{'field': 'digest', 'message': 'Value error, A non-zarr asset must have a sha2_256.'}
]


Expand Down Expand Up @@ -292,7 +292,8 @@ def test_validate_version_metadata_no_assets(
assert draft_version.validation_errors == [
{
'field': 'assetsSummary',
'message': 'A Dandiset containing no files or zero bytes is not publishable',
'message': 'Value error, '
'A Dandiset containing no files or zero bytes is not publishable',
}
]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
include_package_data=True,
install_requires=[
'celery',
'dandischema~=0.8.4',
'dandischema~=0.9.0',
'django~=4.1.0',
'django-admin-display',
# Require 0.58.0 as it is the first version to support postgres' native
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Meditor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const isJSONSchema = (schema: JSONSchemaUnionType): schema is JSONSchema7

export const isBasicSchema = (schema: JSONSchemaUnionType): schema is BasicSchema => (
isJSONSchema(schema)
&& isBasicType(schema.type)
&& (isBasicType(schema.type) || schema.type === undefined)
);

export const isObjectSchema = (schema: JSONSchemaUnionType): schema is ObjectSchema => (
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/CreateDandisetView/CreateDandisetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const descriptionMaxLength: ComputedRef<number> = computed(
() => store.schema.properties.description.maxLength,
);
const dandiLicenses: ComputedRef<LicenseType[]> = computed(
() => store.schema.definitions.LicenseType.enum,
() => store.schema.$defs.LicenseType.enum,
);

if (!loggedIn()) {
Expand Down