[BUG] [Go] [Java] [Python] Duplicate models generated when there are circular references between specs
Created by: shylasrinivas
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? Yes -
Have you validated the input using an OpenAPI validator (example)? Yes. Spec is valid. -
What's the version of OpenAPI Generator used? 5.0.0 SNAPSHOT and 4.3.1 -
Have you search for related issues/PRs? https://github.com/OpenAPITools/openapi-generator/issues/2701 -
What's the actual output vs expected output? Duplicate models with _2 suffix generated in go, 2 suffix in java. I have tested this in java and python and found the same issue.
Description
Models generated twice with same content when there are circular references between 2 specs Issue occurs in Go, Java and Python languages. Eg: model_complex_node_slice.go and model_complex_node_slice_2.go ComplexNodeSlice.java and ComplexNodeSlice2.java
openapi-generator version
4.3.1 and 5.0.0 SNAPSHOT
OpenAPI declaration file content or url
https://gist.github.com/shylasrinivas/af9312c27f6c2a2d99d91c4c2c0323a1
Command line used for generation
openapi-generator generate -g go -i ~/testyamls/linked_list.yaml -o ~/testyamls/test
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/2701
Suggest a fix
Based on https://github.com/OpenAPITools/openapi-generator/issues/2701 it seems the latest swagger parser should have fixed the issue. However, even with 5.0.0 SNAPSHOT version of openapi-generator which is using a newer swagger parser version (2.0.20) I am still seeing this issue. Any help is appreciated.