marshmallow-code / marshmallow-code/marshmallow
RFC: Remove Nested(many=True) to keep only the List(Nested()) form
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
See discussion in https://github.com/marshmallow-code/marshmallow/issues/493#issuecomment-380468027.
We have two ways to do the same thing. They sometimes behave differently, which generally means one of them is buggy.
IMHO, and from what I have seen from users around me, it is more natural for a new user to write `List(Nested)` than `Nested(many)`. Besides, it is consistent with `Dict(values=Nested)`.
I realize this is quite a breaking change, both from user perspective, because `Nested(many=True)` is probably the most commonly used form, and from developer perspective, because it involves a lot of code changes (but also a lot of code removal, which is nice).
There could be things that can be done with `Nested(many=True)` but not with `List(Nested)`, because in the former case, the nested Schema has access to the whole data, while in the latter, it is called on each element. Perhaps some `pre_load` edge cases might suffer from the change. Any real-life example, anyone?
Anyway, since the question was raised in a comment in another issue, I figured I'd give it more visibility.
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 discussion in issue #493 and the comment linked from this RFC; no source file or test is named. Determine whether Nested(many=True) can be removed in favor of List(Nested), including any pre_load or whole-data behavior, and document a project decision before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100