marshmallow-oneofschema icon indicating copy to clipboard operation
marshmallow-oneofschema copied to clipboard

Unable to serialize type field in downstream schemas

Open jbaron34 opened this issue 2 years ago • 0 comments

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

jbaron34 avatar Dec 16 '21 04:12 jbaron34