Skip to content

Commit 9926393

Browse files
committed
copyright: add DataCite serialization
1 parent 525f684 commit 9926393

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

invenio_rdm_records/resources/serializers/datacite/schema.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ def get_subjects(self, obj):
553553
def get_rights(self, obj):
554554
"""Get datacite rigths."""
555555
rights = obj["metadata"].get("rights", [])
556-
if not rights:
556+
copyright = obj["metadata"].get("copyright", None)
557+
if not rights and not copyright:
557558
return missing
558559

559560
serialized_rights = []
@@ -570,6 +571,9 @@ def get_rights(self, obj):
570571
if link:
571572
entry["rightsUri"] = link
572573
serialized_rights.append(entry)
574+
if copyright:
575+
serialized_rights.append({"rights": copyright,
576+
"rightsUri": "http://rightsstatements.org/vocab/InC/1.0/"})
573577

574578
return serialized_rights if serialized_rights else missing
575579

tests/resources/serializers/test_datacite_serializer.py

+5
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
108108
"title": {"en": "No rightsUri license"},
109109
}
110110
)
111+
full_record_to_dict["metadata"]["copyright"] = "2025 © Author(s)"
111112
# for HTML stripping test purposes
112113
expected_data = {
113114
"contributors": [
@@ -224,6 +225,10 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
224225
"rightsUri": "https://creativecommons.org/licenses/by/4.0/legalcode",
225226
},
226227
{"rights": "No rightsUri license"},
228+
{
229+
"rights": "2025 © Author(s)",
230+
"rightsUri": "http://rightsstatements.org/vocab/InC/1.0/",
231+
},
227232
],
228233
"schemaVersion": "http://datacite.org/schema/kernel-4",
229234
"sizes": ["11 pages"],

0 commit comments

Comments
 (0)