marshmallow-code / marshmallow-code/marshmallow

Type hinting for `load` is too strict

Open
#1,457 12 comments 0 reactions 0 assignees View on GitHub
help wanted typing
Dominant language
Python
Stars
7.2k
Forks
738
Avg merge
1d 23h
Merged PRs (30d)
7

Description

The type hinting for `load`'s `data` argument is set to `typing.Mapping` which makes sense for the `many=False` case, but for `many=True` case the type of `data` is `list`, which isn't a `Mapping` type.

Contributor guide

Open the contributing guide

Research direction

Start at the load API and inspect the type annotation for its data argument, then trace how the many=True and many=False cases are represented. Update the annotation so both supported input shapes are covered, and add or adjust tests for loading a mapping and a list.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.