diff --git a/invenio_rdm_records/resources/serializers/datacite/schema.py b/invenio_rdm_records/resources/serializers/datacite/schema.py index 9c031ea386..6a7febb3de 100644 --- a/invenio_rdm_records/resources/serializers/datacite/schema.py +++ b/invenio_rdm_records/resources/serializers/datacite/schema.py @@ -94,8 +94,9 @@ def get_name_identifiers(self, obj): name_id = { "nameIdentifier": identifier["identifier"], "nameIdentifierScheme": id_scheme, - "schemeUri": scheme_uri, } + if scheme_uri: + name_id["schemeUri"] = scheme_uri serialized_identifiers.append(name_id) diff --git a/tests/resources/serializers/test_datacite_serializer.py b/tests/resources/serializers/test_datacite_serializer.py index 0b75804208..fa0cdae5cc 100644 --- a/tests/resources/serializers/test_datacite_serializer.py +++ b/tests/resources/serializers/test_datacite_serializer.py @@ -409,7 +409,6 @@ def test_datacite43_serializer_with_unknown_id_schemes( expected_creator_id = { "nameIdentifier": "unknown-2345", "nameIdentifierScheme": "unknown-scheme", - "schemeUri": "", } serializer = DataCite43JSONSerializer()