marshmallow-code / marshmallow-code/marshmallow
Add ability to set partial default in Meta class
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
It doesn't seem to be possible to configure a default `partial` property in the `Meta` class. Is there a reason for this?
It would be nice to be able to follow a pattern as follows:
```python
class InsertSchema(Schema):
class Meta:
unknown = EXCLUDE
id = fields.UUID(required=False)
name = fields.Str(required=True)
description = fields.Str(required=True)
class UpdateSchema(InsertSchema):
class Meta(InsertSchema.Meta):
exclude = ["id"]
partial = True
```
The `exclude` in `Meta` works as expected, but the `partial` does not. I'm also using `flask_smorest`, so of course I can define this at the request level, e.g.
```
@blueprint.arguments(UpdateSchema(partial=True))
```
but it would be nice to be able to define it at the class-level, especially if the partial configuration is more complex and perhaps the schema is used in multiple places.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Schema and Meta handling, then compare the class-level partial example for UpdateSchema with the existing request-level partial=True usage. Trace how inherited Meta options such as exclude are processed and add coverage for a schema whose fields become partial by default. Done means the Meta setting works while preserving inherited options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100