Skip to content

Inconsistency of return type of OneOfSchema.load #189

Description

@edager

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions