marshmallow-code / marshmallow-code/marshmallow
Reduce confusion around fields.Pluck behavior
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
Follow-up to discussions in https://github.com/marshmallow-code/marshmallow/pull/1298#issuecomment-513354502 and https://github.com/marshmallow-code/marshmallow/issues/1311.
@deckar01 wrote:
> My confusion with the behavior of Pluck concerns me a little. Currently Pluck = flat -> nested -> flat, but it is easily confused with this use case nested -> flat -> nested. Pluck describes the operation during serialization which is similar to Function and Method, but it is really the opposite operation during deserialization. Would it make sense to provide a field that performs the opposite operation? Nest?
@sloria wrote:
> I agree that Pluck is easily misunderstood. I improved the documentation a bit in #1314. Perhaps we could improve the naming to make it more clear, as well as provide a field for the reverse operation (Nest? Deep?)
---
One possible solution might be to rename (or alias, to not break compat) `Pluck` to `Flat` and provide a `Deep` field which does the opposite (what I called `Reach` in https://github.com/marshmallow-code/marshmallow/issues/1311#issuecomment-513478342).
Feedback welcome!
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 discussion in pull request 1298, issue 1311, and the documentation changes in issue 1314. Clarify whether the project wants Pluck renamed or aliased and whether a reverse-operation field should be added. Done means the API direction, compatibility expectations, and field behavior are agreed and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100