model_validate_json() doesn't handle pydantic model fields #852
Unanswered
SonOfLilit
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Without a fix e.g. like below,
SQLModel.model_validate_json()
doesn't recursively parse fields of typepydantic.ModelBase
. I have a branch with a test and this simple fix and @tiangolo if you're interested I'd love to contribute it.The core issue is that we're not doing the
with partial_init():
insqlmodel_validate()
:A more performant fix would be to try and duplicate what's been done in
sqlmodel_validate()
. I can try to do that instead if you ask.This is related to this comment #453 (comment), but I hope my description sheds more light.
It should also in theory be related to #818, but I checked and his code fails both his test and my test, and my code fails his test, so I'm not 100% sure what's going on with it.
Operating System
Windows, macOS
Operating System Details
No response
SQLModel Version
0.0.18, 5a421ad
Python Version
3.9.4, 3.11.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions