I have a schema that uses fields.Nested on a OneOfSchema type schema, where the type field data comes from the parent. I can work around the lack of built-in way to do that with some context, and override get_obj_type / get_data_type.
The new way of doing context in Marshmallow v4 has turned this into a much harder endeavour. I've had to override the load method in the parent schema so I can set a contextvar once per item in the incoming list of data which is now picked up by the nested schema's get_xxx methods.
I'm not really sure if there's any easier way to do it but leaving this Issue here in case someone has already thought about it.
I have a schema that uses
fields.Nestedon aOneOfSchematype schema, where thetypefield data comes from the parent. I can work around the lack of built-in way to do that with some context, and overrideget_obj_type/get_data_type.The new way of doing context in Marshmallow v4 has turned this into a much harder endeavour. I've had to override the
loadmethod in the parent schema so I can set a contextvar once per item in the incoming list of data which is now picked up by the nested schema'sget_xxxmethods.I'm not really sure if there's any easier way to do it but leaving this Issue here in case someone has already thought about it.