diff --git a/dandiapi/api/services/version/metadata.py b/dandiapi/api/services/version/metadata.py index ed3f10011..bc04c8114 100644 --- a/dandiapi/api/services/version/metadata.py +++ b/dandiapi/api/services/version/metadata.py @@ -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 + ) diff --git a/dandiapi/api/tests/test_tasks.py b/dandiapi/api/tests/test_tasks.py index 80ea1d39e..bfffb13f0 100644 --- a/dandiapi/api/tests/test_tasks.py +++ b/dandiapi/api/tests/test_tasks.py @@ -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.'} ] @@ -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', } ] diff --git a/setup.py b/setup.py index 71cb5b6ad..1f10b04df 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/web/src/components/Meditor/types.ts b/web/src/components/Meditor/types.ts index c6b0a7fae..5ca93b13f 100644 --- a/web/src/components/Meditor/types.ts +++ b/web/src/components/Meditor/types.ts @@ -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 => ( diff --git a/web/src/views/CreateDandisetView/CreateDandisetView.vue b/web/src/views/CreateDandisetView/CreateDandisetView.vue index e6c834683..7fb952f2a 100644 --- a/web/src/views/CreateDandisetView/CreateDandisetView.vue +++ b/web/src/views/CreateDandisetView/CreateDandisetView.vue @@ -181,7 +181,7 @@ const descriptionMaxLength: ComputedRef = computed( () => store.schema.properties.description.maxLength, ); const dandiLicenses: ComputedRef = computed( - () => store.schema.definitions.LicenseType.enum, + () => store.schema.$defs.LicenseType.enum, ); if (!loggedIn()) {