Passing schema_extra
to Field has changed in Pydantic 2.0 but not in SQLModel.
#833
Unanswered
HarshTrivedi
asked this question in
Questions
Replies: 2 comments 1 reply
-
Okay, it's been over a week and I am fairly positive this is a bug. So tagging @tiangolo, @maru0123-2004 @daniil-berg, @raphaelgibson based on who have made commits to the lines surrounding the bug. I'll appreciate the help, thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
-
@tiangolo Gentle reminder here. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
PydanticV1's
Field
class supported passing arbitrary keyword arguments to the JSON schema. In SQLModel counterpart, it was supported by passingschema_extra
(see this).PydanticV2 still supports passing extra things to the JSON schema but in a slightly different way. One has to pass a dictionary in the
json_schema_extra
argument (see this).Currently, SQLModel does not reflect the corresponding change in its Field implementation. From what I can tell, it's simply about making one line change to the call here (call to Pydantic's FieldInfo).
For consistency with Pydantic, it may also be better to rename
schema_extra
tojson_schema_extra
.Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.16
Python Version
3.11.0
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions