Skip to content

Commit

Permalink
config: added service schema from config
Browse files Browse the repository at this point in the history
* Added the swhid field to the bibtex schema
  • Loading branch information
alejandromumo committed Nov 22, 2024
1 parent 8d2823f commit 913300b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions invenio_rdm_records/resources/serializers/bibtex/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def _fetch_fields_map(self, data):
"pages": data.get("pages", None),
"note": data.get("note", None),
"venue": data.get("venue", None),
"swhid": data.get("swhid", None),
}

def _format_output_row(self, field, value):
Expand All @@ -261,10 +262,10 @@ def _format_output_row(self, field, value):

elif len(value) > 50:
wrapped = textwrap.wrap(value, 50)
out = " {0:<12} = {{{{{1} \n".format(field, wrapped[0])
for line in wrapped[1:-1]:
out += " {0:<17} {1:<}\n".format("", line)
out += " {0:<17} {1:<}}}}},\n".format("", wrapped[-1])
out = f" {field:<12} = {{{wrapped[0]}\n"
for line in wrapped[1:]:
out += f" {'' :<17} {line}\n"
out += f" {'' :<17}}},\n" # Closing the single brace here
elif field == "month":
out = " {0:<12} = {1},\n".format(field, value)
elif field == "url":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class BibTexFormatter:
"version",
"doi",
"url",
"swhid",
],
}
"""Computer software."""
4 changes: 2 additions & 2 deletions invenio_rdm_records/services/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class RDMRecordServiceConfig(RecordServiceConfig, ConfiguratorMixin):
draft_cls = FromConfig("RDM_DRAFT_CLS", default=RDMDraft)

# Schemas
schema = RDMRecordSchema
schema = FromConfig("RDM_RECORD_SCHEMA", default=RDMRecordSchema)
schema_parent = RDMParentSchema
schema_access_settings = AccessSettingsSchema
schema_secret_link = SecretLinkSchema
Expand Down Expand Up @@ -647,7 +647,7 @@ class RDMCommunityRecordsConfig(BaseRecordServiceConfig, ConfiguratorMixin):

# Service schemas
community_record_schema = CommunityRecordsSchema
schema = RDMRecordSchema
schema = FromConfig("RDM_RECORD_SCHEMA", default=RDMRecordSchema)

# Max n. records that can be removed at once
max_number_of_removals = 10
Expand Down

0 comments on commit 913300b

Please sign in to comment.