Skip to content

Commit 48f25f8

Browse files
committed
🎨 (marshmallow) Improve schemas by removing needless lambdas
1 parent d1c531a commit 48f25f8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

project/04-items-stores-smorest-sqlalchemy/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PlainStoreSchema(Schema):
1414

1515
class ItemSchema(PlainItemSchema):
1616
store_id = fields.Int(required=True, load_only=True)
17-
store = fields.Nested(lambda: PlainStoreSchema(), dump_only=True)
17+
store = fields.Nested(PlainStoreSchema(), dump_only=True)
1818

1919

2020
class ItemUpdateSchema(Schema):

project/05-add-many-to-many/schemas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class PlainTagSchema(Schema):
1919

2020
class ItemSchema(PlainItemSchema):
2121
store_id = fields.Int(required=True, load_only=True)
22-
store = fields.Nested(lambda: PlainStoreSchema(), dump_only=True)
23-
tags = fields.List(fields.Nested(lambda: PlainTagSchema()), dump_only=True)
22+
store = fields.Nested(PlainStoreSchema(), dump_only=True)
23+
tags = fields.List(fields.Nested(PlainTagSchema()), dump_only=True)
2424

2525

2626
class ItemUpdateSchema(Schema):
@@ -30,7 +30,7 @@ class ItemUpdateSchema(Schema):
3030

3131
class StoreSchema(PlainStoreSchema):
3232
items = fields.List(fields.Nested(PlainItemSchema()), dump_only=True)
33-
tags = fields.List(fields.Nested(lambda: PlainTagSchema()), dump_only=True)
33+
tags = fields.List(fields.Nested(PlainTagSchema()), dump_only=True)
3434

3535

3636
class TagSchema(PlainTagSchema):

0 commit comments

Comments
 (0)