Skip to content

Commit

Permalink
Merge pull request #153 from the-mama-ai/fix-marshmallow-warnings
Browse files Browse the repository at this point in the history
chore(test): fix marshmallow deprecation warnings
  • Loading branch information
athornton authored Mar 7, 2024
2 parents 8c3169d + 6030d1d commit 422fad8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
9 changes: 5 additions & 4 deletions giftless/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import marshmallow
from flask_marshmallow import Marshmallow
from marshmallow import fields, pre_load, validate
from marshmallow_enum import EnumField

ma = Marshmallow()

Expand All @@ -32,7 +31,7 @@ class ObjectSchema(ma.Schema): # type:ignore[name-defined]
oid = fields.String(required=True)
size = fields.Integer(required=True, validate=validate.Range(min=0))

extra = fields.Dict(required=False, missing=dict)
extra = fields.Dict(required=False, load_default=dict)

@pre_load
def set_extra_fields(
Expand All @@ -51,8 +50,10 @@ def set_extra_fields(
class BatchRequest(ma.Schema): # type:ignore[name-defined]
"""batch request schema."""

operation = EnumField(Operation, required=True)
transfers = fields.List(fields.String, required=False, missing=["basic"])
operation = fields.Enum(Operation, required=True)
transfers = fields.List(
fields.String, required=False, load_default=["basic"]
)
ref = fields.Nested(RefSchema, required=False)
objects = fields.Nested(
ObjectSchema, validate=validate.Length(min=1), many=True, required=True
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ warn_unused_ignores = true
[[tool.mypy.overrides]]
module = [
"flask_classful",
"marshmallow_enum",
"webargs"
]
ignore_missing_imports = true
Expand Down
1 change: 0 additions & 1 deletion requirements/main.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
figcan==0.0.*
flask~=2.3
flask-marshmallow~=0.15
marshmallow-enum~=1.5
pyyaml~=6.0
PyJWT~=2.4
webargs~=8.3
Expand Down
5 changes: 1 addition & 4 deletions requirements/main.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --no-emit-index-url --output-file=requirements/main.txt requirements/main.in
Expand Down Expand Up @@ -91,10 +91,7 @@ markupsafe==2.1.3
marshmallow==3.20.2
# via
# flask-marshmallow
# marshmallow-enum
# webargs
marshmallow-enum==1.5.1
# via -r requirements/main.in
packaging==23.2
# via
# flask-marshmallow
Expand Down

0 comments on commit 422fad8

Please sign in to comment.