Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6926
Closed
Open
Issue created Jul 14, 2020 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[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.

Assignee
Assign to
Time tracking