marshmallow-code / marshmallow-code/marshmallow
Feature - allow inheriting load_default from nested schema populated with from_dict
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
Using with APIFlask
```
class APICreateTicketIn(Schema):
notify = fields.Nested(
Schema.from_dict(
{
"reviewer": fields.Boolean(load_default=False),
"requestor": fields.Boolean(load_default=False),
"responsible": fields.Boolean(load_default=False),
},
name="APICreateTicketIn_Notify",
),
load_default={
"reviewer": False,
"requestor": False,
"responsible": False,
},
required=False,
)
```
If only the 'load_default' in the nested "notify" schema are supplied, it doesn't actually get any defaults - had to add the raw load_default in the top level schema object. (I think the load_default in the from_dict isn't used at all.)
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 with the reproducer in the issue and inspect Schema.from_dict together with nested-field deserialization. Confirm how load_default is handled for the generated nested schema, then add a regression test showing that nested defaults work without duplicating them on the top-level field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100