Skip to content

Commit

Permalink
schema: updated json serializer removed sortBy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatimah authored and slint committed Jan 25, 2024
1 parent b5268aa commit a437820
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions site/zenodo_rdm/legacy/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""Zenodo legacy serializers."""

from flask_resources import BaseListSchema, JSONSerializer, MarshmallowSerializer
from marshmallow import fields, post_dump
from marshmallow import fields, missing, post_dump

from .schemas import (
LegacyFileListSchema,
Expand All @@ -33,6 +33,12 @@ def unwrap_hits(self, data, many, **kwargs):
return data.get("hits", {}).get("hits", [])


class ZenodoListSchema(BaseListSchema):
"""Zenodo top-level List schema."""

sortBy = fields.Field(load_only=True)


class LegacyJSONSerializer(MarshmallowSerializer):
"""Legacy metadata serializer."""

Expand All @@ -53,7 +59,7 @@ def __init__(self):
super().__init__(
format_serializer_cls=JSONSerializer,
object_schema_cls=ZenodoSchema,
list_schema_cls=BaseListSchema,
list_schema_cls=ZenodoListSchema,
)


Expand Down

0 comments on commit a437820

Please sign in to comment.