Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency of return type of OneOfSchema.load #189

Open
edager opened this issue Mar 28, 2024 · 0 comments
Open

Inconsistency of return type of OneOfSchema.load #189

edager opened this issue Mar 28, 2024 · 0 comments

Comments

@edager
Copy link

edager commented Mar 28, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant