refactor: Replace the models
package with one models
module, which contains all models
#636
Labels
✨ enhancement
New feature or improvement
Is your feature request related to a problem? Please describe.
One of the issues that block implementation of #466 or #563 is circular import occurs in the case of circular and recursive references.
Describe the solution you'd like
I want to move the generated models to one module because it simplifies the support of circular and recursive reference development. See #563 and #466. Seems @maz808's pull request #563 solves several problems with references and would be great to finish it and merge. But it contains a circular import problem. I've described it this message.
I've already implemented a possible solution in this branch. Maybe it's done not enough accurately but seems it's working. I want to receive feedback to complete this and #563.
Describe alternatives you've considered
The alternate solution is to continue using package
models
with a separate module for each model. We may prevent the circular import problem by David Beasley hack, using this statement in the model template:It also will produce the working client code, but it has more complexity. I believe the one module is more ergonomic. Because for instance one of my OpenAPI specs has a lot of circular references. In that case, it produces a lot of strings with the statements, I've mentioned above. It will look like
And I believe I have models with more recursive references 😅
Additional context
The text was updated successfully, but these errors were encountered: