-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Fix Missing Imports #2009
Fix Missing Imports #2009
Conversation
…feat/2001-missing-imports
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2009 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 38 38
Lines 4188 4197 +9
Branches 961 967 +6
=========================================
+ Hits 4188 4197 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
for more information, see https://pre-commit.ci
CodSpeed Performance ReportMerging #2009 will not alter performanceComparing Summary
|
@luca-knaack-webcom https://github.com/koxudaxi/datamodel-code-generator/pull/2009/files |
@koxudaxi |
The
processed_models
array storesProcessed
objects, which include models and their imports after being handled by theparser/base.py:parse
function. However, sincemodels
are objects (passed by reference), theProcessed
objects and their models can be modified after creation. This can sometimes result in model changes without corresponding updates to the model imports, leading to broken Pydantic models (example is given in #2001).This PR addresses this issue by introducing a post-processing step in the base parser's parsing method, ensuring that all necessary imports are correctly included.
Fixes #2001