marshmallow-code / marshmallow-code/marshmallow
Accessing previously deserialized field data from a different field
Nobody has claimed this yet.
- 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
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 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