Skip to content
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

Remove model_rebuild calls #241

Merged
merged 4 commits into from
Nov 21, 2023
Merged

Remove model_rebuild calls #241

merged 4 commits into from
Nov 21, 2023

Conversation

mat-sop
Copy link
Contributor

@mat-sop mat-sop commented Nov 21, 2023

I found that pydantic v2 changed how forward refs are handled during model class initialization. If a model has annotation that can`t be resolved on class definition then there is performed auto-rebuild during the first attempt at validation https://github.com/pydantic/pydantic/blob/main/tests/test_forward_ref.py#L70

So there is no need for us to call it for each model manually, this pr removes those calls.

resolves #237 #226

@mat-sop mat-sop self-assigned this Nov 21, 2023
@mat-sop mat-sop merged commit f71271d into main Nov 21, 2023
4 checks passed
@mat-sop mat-sop deleted the model_rebuild_calls branch November 21, 2023 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

model_rebuild hits infinite recursion, replacing with model_construct works
2 participants