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
  • #6907
Closed
Open
Issue created Jul 10, 2020 by Administrator@rootContributor

[REQ] Add enumClassPrefix option for Go server

Created by: mraineri

Is your feature request related to a problem? Please describe.

I'm currently trying to build a Go server from an OpenAPI spec that contains enumerations where some values are re-used in different enumerations. Doing so today, it results in the following errors when building:

$ go build
# github.com/GIT_USER_ID/GIT_REPO_ID/go
go/model_account_service_v1_7_1_account_provider_types.go:19:2: OEM redeclared in this block
	previous declaration at go/model_acceleration_function_v1_0_2_acceleration_function_type.go:23:57
go/model_account_service_v1_7_1_authentication_types.go:19:2: OEM redeclared in this block
	previous declaration at go/model_account_service_v1_7_1_account_provider_types.go:19:47

Describe the solution you'd like

Issue #535 discusses this same problem in the context of Go clients, and others have been able to get around this by using the enumClassPrefix option to add the name of the enumeration to the enum values in order to ensure uniqueness. The Go server option list is limited and does not currently support enumClassPrefix. I would like the same functionality to be made available for Go server code generation.

Describe alternatives you've considered

Changing all enumeration values to ensure uniqueness in the specification itself would be another way around this, but unfortunately the API is shipping at this time and would break compatibility with existing clients.

Assignee
Assign to
Time tracking