marshmallow-code / marshmallow-code/marshmallow

allow for overriding dump’s iteration behavior

Open
#798 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
738
Avg merge
1d 23h
Merged PRs (30d)
7

Description

Currently at: https://github.com/marshmallow-code/marshmallow/blob/1781e9a18895aa9b473fb5587de3cf922416733e/marshmallow/schema.py#L396-L397 iteration behavior is determined by list(). Would it be considered a useful feature to be able to override this behavior with a function that takes the object and returns an iterator? (similar to the way _serializer can be overriden)

def _dumper(obj):
    return (i for i in obj)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in marshmallow/schema.py at the referenced lines where dump iteration is determined by list(), then compare the existing _serializer override behavior. Trace the surrounding dump flow and relevant tests. Done means callers can provide an object-to-iterator override while the current behavior remains unchanged by default.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.