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

[wip] handle union/optional fields in a tuple #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ameesha
Copy link

@ameesha ameesha commented Nov 6, 2019

when you have a tuple where a type of the field is Optional[*] it becomes a Union type and breaks when trying to deserialize None to whatever value it expects.

Adding a check that if it's explicitly a union type, attempt to use all the args, whichever works first to allow that through, if a type error arises, just ignore it.

problems right now:

  1. if it's a union of type [str, int] and the value is something like 42, the first arg type would succeed -- taking suggestions on other ways to handle this if any.
  2. nested unions don't work

@ameesha ameesha changed the title handle union/optional fields in a tuple [wip] handle union/optional fields in a tuple Nov 6, 2019
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

Successfully merging this pull request may close these issues.

1 participant