marshmallow-code / marshmallow-code/marshmallow
Configuring only, exclude, load_only, and dump_only on fields.Nested()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
ref https://github.com/marshmallow-code/marshmallow/pull/572
There are currently a number of inconsistencies with configuration of `only`, `exclude`, `load_only`, and `dump_only` on `fields.Nested`.
The biggest one is that `only` and `exclude` are specified when constructing the `fields.Nested`, but `load_only` and `dump_only` come from dot-delimited fields on the `Schema`.
Additionally, the `only` parameter on `fields.Nested` takes a string, while `exclude` does not – and `only` and `exclude` on `Schema` both only take a string.
I would like to be able to use syntax like `fields.Nested(ChildSchema, dump_only=('child.id',))`. However, it's not clear to me how this would interact with the options passed in at schema construction time.
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
Review the fields.Nested configuration and the Schema options for only, exclude, load_only, and dump_only, then compare the behavior described in the issue with pull request 572. Clarify how constructor-time and schema-level options should interact, including the proposed dotted-field syntax. Done means the configuration rules are consistent and the supported behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100