marshmallow-code / marshmallow-code/marshmallow

Accessing previously deserialized field data from a different field

Open
#1,387 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

class MySchema(NamespacedSchema):
    name = fields.String()
    customData = CustomDataField()
    complextData = ComplextDataField()

In the above schema, the ComplextDataField depends on the customData to deserialize, but then customData is not available in the data dict. Reading the docs, it looks like we can use schema context to pass data between dependent fields, any other easy way?

Any reason the previously deserialized fields are not available in the data param ? in def deserialize(self, value, attr=None, data=None)

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 with the field deserialization path around deserialize(self, value, attr=None, data=None) and the schema-context documentation mentioned in the issue. Determine whether dependent fields should receive previously deserialized data, using the example schema to define the expected behavior; no file or test path is identified in the payload.

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.