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
  • #2752
Closed
Open
Issue created Apr 27, 2019 by Administrator@rootContributor

[REQ] [go-gin-server] place models in different package to prevent circular package references

Created by: pconstantinou

Golang doesn't allow packages to have circular references. Currently, the go-gin-server implementation places the model and api definition code in the same package. This makes using models generated from OpenAPI difficult to use outside of the package.

Currently, for example, you can't have the API call a separate database package with a model object as a parameter, because it requires making circular package references.

Describe the solution you'd like

Ideally, there would be the option of having a separate model package from an API package.

Describe alternatives you've considered

The current workaround is either putting all your database code in the generated API objects or replicating the model objects within a separate package (duplicating code).

Additional context

The openapi generator libraries seem to allow for separate package and API names but those parameters are ignored by the go-gin-server generator.

#1931 also discusses this a similar issue

Assignee
Assign to
Time tracking