Description
Motivation
I often have lots of small schemas containing unique Meta
classes with only a few attributes. The Meta
class sometimes requires more lines than the schema definition and makes a file containing multiple schemas harder to read. This is especially true when using marshmallow-jsonapi
due to type_
.
Proposal
Provide a meta
decorator that will inject its kwargs into a Meta
class for the class it is wrapping.
Example
Before:
class TestSchema(Schema):
foo = fields.String()
bar = fields.String()
class Meta:
type_ = 'tests'
ordered = True
After:
@meta(type_='tests', ordered=True)
class TestSchema(Schema):
foo = fields.String()
bar = fields.String()
Metadata
Metadata
Assignees
Labels
No labels