-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] BackLink causes error when using model_json_schema() #1008
Comments
Possible cause of this error: Lines 473 to 479 in 51e73eb
See this discussion of a similar error with Pydantic v2.4 A correct implementation already exists on the Lines 408 to 430 in bdb6a86
|
Thanks for reporting the issue, and taking the time to investigate the cause. Would you like to send a PR to fix this issue, @gdlmx? |
@adeelsohailahmed @gdlmx Any updated about this fix yet? |
Yes, I can prepare a PR to fix it. Could you provide me some idea about the proper json schema for BackLink? Given this line Line 468 in 51e73eb
There is no guarantee of any field in a BackLink object, is there? |
I'm not sure if I fully understand your question here. Could you elaborate more? |
@gdlmx is there any update about the PR? :-) |
add test for BackLink json_schema
BeanieODM#1008 add test for BackLink json_schema
include a base class for BackLink due to a bug in pydantic v1 pydantic/pydantic#3390
Describe the bug
Generating Json Schema from a document with a
BackLink
field will fail with the error:PydanticInvalidForJsonSchema
.To Reproduce
The last line will raise error:
Expected behavior
The last line (model_json_schema) should return
Additional context
Python version: 3.11
Beanie version: 1.26.0
Pydantic version: 2.8.2
The text was updated successfully, but these errors were encountered: