You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
employees is a Union of Manager and Employee, and Manager is a subclass of Employee. In 3.6, typing.pythrows away direct subclasses in Unions, so in DepartmentModel.__annotations__, the employees field is listed as typing.List[__main__.EmployeeModel], and not typing.List[typing.Union[__main__.ManagerModel, __main__.EmployeeModel]] as in 3.7, so all of the introspection that we rely on has no way of knowing that employees is a Union of Manager and Employee, it just thinks it's an employee.
In the documentation for Union they explicitly note that subclasses are no longer thrown out as of python 3.7.
See #10 -- while the examples work fine in Python 3.7, it would be ideal if we could make them work (or document where they don't) in 3.6
The text was updated successfully, but these errors were encountered: