From 394e457c3914b35faf471e02712c61db63fd4b92 Mon Sep 17 00:00:00 2001 From: Dorothea Iglezakis Date: Thu, 22 Oct 2020 10:50:27 +0200 Subject: [PATCH] only adding type_field to dump result, if type_field_remove is not true --- marshmallow_oneofschema/one_of_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marshmallow_oneofschema/one_of_schema.py b/marshmallow_oneofschema/one_of_schema.py index 7957f46..2348334 100644 --- a/marshmallow_oneofschema/one_of_schema.py +++ b/marshmallow_oneofschema/one_of_schema.py @@ -105,7 +105,7 @@ def _dump(self, obj, *, update_fields=True, **kwargs): schema.context.update(getattr(self, "context", {})) result = schema.dump(obj, many=False, **kwargs) - if result is not None: + if result is not None and not self.type_field_remove: result[self.type_field] = obj_type return result