[typescript-axios] Classes are not self-aware, try to import self
Description
Hi, the code I generated from swagger spec is throwing a tsc error. The reason is that the model class, DocumentTreeNodeDto, has a field childNodes that is, of course, a List of DocumentTreeNodeDtos. The code generator is creating the DocumentTreeNodeDto model class with
import { DocumentTreeNodeDto } from './document-tree-node-dto';, and tsc says error TS2440: Import declaration conflicts with local declaration of DocumentTreeNodeDto.
Swagger-codegen version
3.0.36
Swagger declaration file content or url
"DocumentTreeNodeDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"parentId":{"type":"integer","format":"int64"},"ids":{"type":"array","items":{"type":"object","additionalProperties":{"type":"integer","format":"int64"}}},"childNodes":{"type":"array","items":{"$ref":"#/components/schemas/DocumentTreeNodeDto"}},"nodeName":{"type":"string"},"rank":{"type":"integer","format":"int32"},"deleteType":{"type":"string"},"document":{"$ref":"#/components/schemas/DocumentDto"},"createdAt":{"type":"string","format":"date-time"}}}
Command line used for generation
swagger-codegen generate -i swagger.json -l typescript-axios -o frontend/api
Steps to reproduce
Generate swagger spec and run codegen for Java/Spring Boot class that refers to itself in its fields
Suggest a fix/enhancement
import statements should exclude the class itself that is being generated.
I stumpeld accros the same bug. Is there any progress or does any workaround exist to solve this problem?
The code produced by the online generator is affected.