Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] Add enumClassPrefix option for Go server #6907

Closed
mraineri opened this issue Jul 10, 2020 · 2 comments · Fixed by #7008
Closed

[REQ] Add enumClassPrefix option for Go server #6907

mraineri opened this issue Jul 10, 2020 · 2 comments · Fixed by #7008

Comments

@mraineri
Copy link
Contributor

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.

@wing328
Copy link
Member

wing328 commented Jul 12, 2020

@mraineri thanks for the suggestion. I wonder if you've time to file a PR to make the enhancement to the Go server generator.

@mraineri
Copy link
Contributor Author

Sure, I can take a look at making the enhancement myself and contributing it back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants