List[Union[A,B,C]] types are casted to the wrong type if types are similar #2135
Closed
3 tasks done
Labels
bug V1
Bug related to Pydantic V1.X
Checks
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Hi, I'm writing a slack application which has multiple types which have the same fields and the only difference is the content of the field: https://api.slack.com/types/user
E.g: Difference between channel ID and user ID(A):
CJ03ECZLG
XUJ03ECZLG
(user starts with U)And for some reason Pydantic casts Channel (C) to the User (U) based on the order of types inside the annotation.
Am I using pydantic wrong or is the a legitimate bug?
If there is a better approach or workaround it would be much appreciated.
Thank you.
Actual result
Expected result:
The text was updated successfully, but these errors were encountered: