marshmallow-code / marshmallow-code/marshmallow-sqlalchemy

Inconsistent behaviour of load_instance with nested schemas

Open
#400 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
580
Forks
101
Avg merge
7h 6m
Merged PRs (30d)
3

Description

Thanks to this MR, it is now possible to define load_instance at the instance level (MySchema(load_instance=False)).

However, as far as I can tell, this setting is not inherited by nested schemas, and there is no easy way to make the nested schema behave like its parent… Resulting in half-loaded schemas (top-level is a dict, with instances underneath).

Could we consider changing that, or is there an obvious workaround that I am missing?

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

Review MR 380 and the MySchema(load_instance=False) configuration path first, then trace how nested schemas receive the load_instance setting. Done means the behavior is consistent between the top-level and nested schemas, with regression coverage for the reported half-loaded result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
databases
Issue type
Bug
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.