The problem is that with the changes to have the class property types used directly, circular type referencing or recursive definitions doesn't seem to work anymore:
OpenAPI declaration file content or url
components:
schemas:
Dog:
properties:
enemy:
type: object
$ref: '#/components/schemas/Dog'
This should be a valid spec, but the generated python attempts to reference the Dog class in the definition of the Dog class - which clearly doesn't work. This causes a circular import. This looks to be a regression from just the plain python generator - which uses strings to define openApi types. What are your thoughts on this?
Command line used for generation
Normal generation for python-experimental using any spec which has a circular reference.
Steps to reproduce
Make a spec with a circular reference, run the python-experimental generator, attempt to use the client, and you'll get an import error.
Related issues/PRs
This started happening with #4446 .
Suggest a fix
@spacether suggested simply storing a model's parameter types as a class method rather than a dict. Then they will not be loaded at module load time.
The problem is that with the changes to have the class property types used directly, circular type referencing or recursive definitions doesn't seem to work anymore:
OpenAPI declaration file content or url
This should be a valid spec, but the generated python attempts to reference the Dog class in the definition of the Dog class - which clearly doesn't work. This causes a circular import. This looks to be a regression from just the plain python generator - which uses strings to define openApi types. What are your thoughts on this?
Command line used for generation
Normal generation for python-experimental using any spec which has a circular reference.
Steps to reproduce
Make a spec with a circular reference, run the python-experimental generator, attempt to use the client, and you'll get an import error.
Related issues/PRs
This started happening with #4446 .
Suggest a fix
@spacether suggested simply storing a model's parameter types as a class method rather than a dict. Then they will not be loaded at module load time.