flask-pydantic
flask-pydantic copied to clipboard
annotations bug
When
from __future__ import annotations
is imported got following error:
**{
key: value
for key, value in query_params.to_dict(flat=False).items()
> if key in model.__fields__ and model.__fields__[key].is_complex()
},
}
E AttributeError: 'str' object has no attribute '__fields__'
local model variable became str instead of pydantic class
Virtualenv Python: 3.11.7 Implementation: CPython
System Platform: darwin OS: posix Python: 3.11.7
@GrafLearnt Hi there, thank you for your bug report. Can you please include some more details? Like the model you are trying to verify against? it be nice if you could include a minimal example for us to look into!
This is my understanding of the problem, is that if you have from future import annotations anywhere in the code, the package will have problem like