Bug Report Checklist
Description
When generating enums in golang the values of the enums are put in a global context (see #21623 for reference). To give a better understanding look like it works in Java for example: Suppose we have two enums MachineState and PetState. If both of those have a enum called SOLD this will work in Java just fine as those dodge each other as they are contained within their enums. In Golang it dumps those 2 context in the global context and you get a compile issue (redeclaration). EDIT: enumClassPrefix helps. PR #21897 adds a testcase for it to proof it working
openapi-generator version
master branch
OpenAPI declaration file content or url
contained in PR #21897
Generation Details
- Inline enums in PR but is the same for normal non inline enums
Steps to reproduce
define two enums using the same constants
Related issues/PRs
#21623
#21897
Suggest a fix
implement a option prefix_enums which will put the model name in front (e.g. MachineSold, PetSold)
Bug Report Checklist
Description
When generating enums in golang the values of the enums are put in a global context (see #21623 for reference). To give a better understanding look like it works in Java for example: Suppose we have two enumsEDIT: enumClassPrefix helps. PR #21897 adds a testcase for it to proof it workingMachineStateandPetState. If both of those have a enum calledSOLDthis will work in Java just fine as those dodge each other as they are contained within their enums. In Golang it dumps those 2 context in the global context and you get a compile issue (redeclaration).openapi-generator version
master branch
OpenAPI declaration file content or url
contained in PR #21897
Generation Details
Steps to reproduce
define two enums using the same constants
Related issues/PRs
#21623
#21897
Suggest a fix
implement a option prefix_enums which will put the model name in front (e.g.
MachineSold,PetSold)