-
-
Notifications
You must be signed in to change notification settings - Fork 301
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(ModuleImports): This PR fixes the module import resolver for module of type BaseClassDataType
#1862
fix(ModuleImports): This PR fixes the module import resolver for module of type BaseClassDataType
#1862
Conversation
…pe BaseClassDataType, it needs to be ensured that the from_ value is joined appropriately.
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 #1862 +/- ##
=======================================
Coverage ? 98.89%
=======================================
Files ? 37
Lines ? 4163
Branches ? 969
=======================================
Hits ? 4117
Misses ? 29
Partials ? 17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #1862 will not alter performanceComparing Summary
|
@rshah-evertz Thank you!! |
@rshah-evertz I have the same issue, and your fix would be great. Do you need help to write the unit test? |
I actually do need help with the unit test. How do I regenerate the expected files with the default timestamp of |
…t resolver works as intended.
…type' into fix-imports-for-base-class-data-type
I've changed the existing nested directory structure to test the change I've made. Also, manually fixed the timestamps of newly generated expected files because I couldn't figure out how to run the codegen with the default timestamp. |
Unsure about why codecov is failing. Any ideas? @koxudaxi |
Description
Currently, there is a bug in datamodel-codegenerator's import resolver. While parsing and resolving the imports for a module, if the data model is of data type
BaseClassDataType
and the length of splitreference_path
is greater than the length of splitcurrent_module
, the finaloutput_path
resolved is incorrect.Example
current_module
: "api.schemas"reference
: "api.this.that.ClassToImport"relative(current_module, reference)
returns: ('.this', 'that')resulting
from_
value for model of instanceBaseClassDataType
:.thisthat
This PR fixes this error by ensuring that when joining the tuple returned by the
relative
method it is checked that the first item in the tuple ends with a.
Is this acceptable, @koxudaxi?