Hi there,
The current implementation of OneOfSchema.load is causing me errors downstream due to heterogeneity of the type of objects being returned.
My particular issue was due to how result is constructed when there's a ValdidationError for many==False (have a look here).
In the current implementation, result ends up being nested in a list [{"type": "foo"}] when there is a ValidationError (through the valid_data attribute), and equal to the input when where's no error.
Secondly result is constructed in a what appears to be an overly convoluted way where result gets set, then appended to a different variable that the overwrites the result....
I would gladly make a PR with a refactored version of OneOfSchema.load if that's allowed?
Hi there,
The current implementation of
OneOfSchema.loadis causing me errors downstream due to heterogeneity of the type of objects being returned.My particular issue was due to how
resultis constructed when there's aValdidationErrorformany==False(have a look here).In the current implementation,
resultends up being nested in a list[{"type": "foo"}]when there is a ValidationError (through the valid_data attribute), and equal to the input when where's no error.Secondly
resultis constructed in a what appears to be an overly convoluted way where result gets set, then appended to a different variable that the overwrites the result....I would gladly make a PR with a refactored version of
OneOfSchema.loadif that's allowed?