-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Enable pydantic_model_creator to use Forward references using ReverseRelation in different files #1842
base: develop
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #1842 will not alter performanceComparing Summary
|
Pull Request Test Coverage Report for Build 12632106944Details
💛 - Coveralls |
@eyllanesc-JE, could you please explain why setting |
@markus-96 any chance you can weight in here since you contributed to the pydantic integration recently? |
@henadzit maybe next week, too busy right now... But what I can say is that I did not encounter this bug yet, although I am working on a project right now that makes heavy use of defining models in different packages. Also, please take the comment into account I made in the corresponding issue: #1841 (comment) |
By default if the global namespace is not set then the mro is used where the elements such as the fields indicated in the bug are defined. See the docs:
By overriding global namespace then get_type_hints does not have access to properties of the Model namespace. But only to the new models themselves. In my solution using locals namespace I am adding elements that typing.get_type_hints does not know about, such as models in other files. Another solution could be that pydantic_model_creator can be passed the locals and globals namespace giving the programmer more freedom to see which elements get_type_hints needs. |
Description
Motivation and Context
Solution for #1841
How Has This Been Tested?
Checklist: