marshmallow-code / marshmallow-code/marshmallow-oneofschema
Unable to serialize type field in downstream schemas
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 142
- Forks
- 44
- Avg merge
- 7h 7m
- Merged PRs (30d)
- 3
Description
What is the purpose of the following line?
https://github.com/marshmallow-code/marshmallow-oneofschema/blob/d65a115c2fcf4e7c635dce2be9561b075e546800/marshmallow_oneofschema/one_of_schema.py#L118
It's preventing me from applying any special serialization rules to the type field in the downstream schemas since the serialized value is being overwritten by this line with the original, non serialized version.
IMO the decision of whether or not to add the type field to the serialized result should solely be the responsibility of the downstream schema.
I've overridden the `_dump` method with an exact copy minus this line (and the preceding line) in my own repo which seems to have solved the issue but I don't know if I may have introduced unexpected behaviour elsewhere.
Related to #126
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 marshmallow_oneofschema/one_of_schema.py at the linked _dump implementation around line 118, then read related issue #126 for context. Reproduce the case with a downstream schema that applies custom serialization to the type field; done means that serialization is not overwritten while existing type-field behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100