pynamodb-attributes icon indicating copy to clipboard operation
pynamodb-attributes copied to clipboard

[wip] handle union/optional fields in a tuple

Open ameesha opened this issue 6 years ago • 0 comments

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 avatar Nov 06 '19 18:11 ameesha