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
Describe the bug
We're parsing objects using MyModel.__response__, then pass the objects as if they were instances of MyModel. This fails because isinstance(obj, MyModel) return False.
Expected behavior
I'm not sure if this is intended or not and if it should be considered a bug in pydantic-duality, but such behavior was unexpected – it requires to always check for both isinstance(obj, MyModel) and isinstance(obj, MyModel.__response__) when the code works with objects parsed by MyModel.__response__.
Screenshots
If applicable, add screenshots to help explain your problem.
Operating system
macOS
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
I looked into it. I did do this for reverse checks ( isinstance(obj, cls.__request__)) but not for the other types of checks. The current architecture is based on building completely different MRO for each object (where cls.__request__ is based on the .__request__ of its parents, and so on) which means that the classes you are trying to compare are completely unrelated.
A completely different architecture seems to be necessary to fix the issue you are referencing. Do you have any ideas?
Describe the bug
We're parsing objects using
MyModel.__response__
, then pass the objects as if they were instances ofMyModel
. This fails becauseisinstance(obj, MyModel)
returnFalse
.To Reproduce
Steps to reproduce the behavior:
DualBaseModel
__response__
.isinstance()
. The check fails:Expected behavior
I'm not sure if this is intended or not and if it should be considered a bug in pydantic-duality, but such behavior was unexpected – it requires to always check for both
isinstance(obj, MyModel)
andisinstance(obj, MyModel.__response__)
when the code works with objects parsed byMyModel.__response__
.Screenshots
If applicable, add screenshots to help explain your problem.
Operating system
macOS
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: