-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding v1 / v2 incompatibility warning for nested v1 model #10431
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
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
8f9599f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3c809738.pydantic-docs.pages.dev |
| Branch Preview URL: | https://incompat-warning.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #10431 will not alter performanceComparing Summary
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
| if issubclass(obj, BaseModelV1): | ||
| warn( | ||
| f'Nesting V1 models inside V2 models is not supported. Please upgrade `{obj.__name__}` to V2.', | ||
| UserWarning, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will warn when doing the following:
from pydantic import TypeAdapter
from pydantic.v1 import BaseModel as BaseModelV1
TypeAdapter(BaseModelV1)So maybe there's a way to check for the current model stack before warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we don't support TypeAdapter with v1 models anyways... so maybe I should just make the warning more broad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified the warning accordingly
Contributing to #10314