marshmallow-code / marshmallow-code/marshmallow-oneofschema
OneOfSchema can't use pre/post_dump/load decorators
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 142
- Forks
- 44
- Avg merge
- 7h 7m
- Merged PRs (30d)
- 3
Description
``` py
class MyUberSchema(OneOfSchema):
type_schemas = {
'foo': FooSchema,
'bar': BarSchema,
}
@post_load
def whatever(self, data):
print("post load")
```
AFAIU, post_load decorated method is never called. It may be intended, or it may not be an issue, but while trying to do that it failed and I didn't see this documented so I don't know if this is known.
To get this to work, the post_load method needs to be defined in FooSchema and BarSchema (or a common parent).
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 by tracing how OneOfSchema handles marshmallow pre/post_dump and pre/post_load decorators, then compare that behavior with the FooSchema and BarSchema workaround described here. Confirm whether decorators on OneOfSchema are expected to run; the work is complete when the behavior is covered by regression tests and its supported usage or limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100