-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[bug][python][model] Should not import self #7541
Comments
ran into this too... did not occur in v2.2.3 |
Seeing this as well on 2.3.0. Maybe related to #6839? (looking at the generated |
Same issue....had to manually remove one of the circular references before building. |
@jacobweber Try #7542, It works for me~ |
In my opinion we should remove these imports from models. It makes a lot of problems with circular dependencies between 2 or more models (model A has an attribute with model B and model B has a optional attribute with model A). These imported objects are not used at all and we know about it - we added F401 to disable warning from pylint :/ |
Didn't have time to make any contributions to the referenced PR, but I made a gist that can be used to comment out the problematic lines after the code is generated. Hopefully this can be useful for those still dealing with this problem. https://gist.github.com/macks22/a087cce914090b4a5d3a16e8ab3c28aa |
We currently have data models that use other data types as part of their definition. We are seeing circular imports in this case. If datatype A uses data type B as a part of one variable type. The import for datatype B is present in the datatype A file (not needed as the type is used only as string or doc string). But then datatype B imports datatype A (causing circular import - again not needed) I have to manually comment out one of these import statements before my auto-generated client works without an import error! Is this currently being worked on? |
Description
Swagger-codegen version
2.3.1
Swagger declaration file content or url
Command line used for generation
generate -l python
The text was updated successfully, but these errors were encountered: