-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
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 EDIT: enumClassPrefix helps. PR #21897 adds a testcase for it to proof it workingMachineState
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).
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
Suggest a fix
implement a option prefix_enums which will put the model name in front (e.g. MachineSold
, PetSold
)