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

datacite: fix funding serialization for optional award fields #1898

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions invenio_rdm_records/resources/serializers/datacite/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from flask_resources.serializers import BaseSerializerSchema
from invenio_access.permissions import system_identity
from invenio_i18n import lazy_gettext as _
from invenio_records_resources.proxies import current_service_registry
from marshmallow import Schema, ValidationError, fields, missing, post_dump, validate
from marshmallow_utils.fields import SanitizedUnicode
from marshmallow_utils.html import strip_html
Expand Down Expand Up @@ -617,8 +616,12 @@ def get_funding(self, obj):
# award
award = funding.get("award")
if award: # having an award is optional
funding_ref["awardTitle"] = award.get("title", {}).get("en", missing)
funding_ref["awardNumber"] = award["number"]
award_title = award.get("title", {}).get("en")
if award_title:
funding_ref["awardTitle"] = award_title
award_number = award.get("number")
if award_number:
funding_ref["awardNumber"] = award_number

identifiers = award.get("identifiers", [])
if identifiers:
Expand Down
Loading