Skip to content

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