forked from loafle/openapi-generator-original
[REQ] Added enumClassPrefix option to Go server generation (#7008)
* Added enumClassPrefix option to Go server generation * Using literal 'true' instead of string
This commit is contained in:
parent
c1b8c294aa
commit
51c45eb28b
@ -11,6 +11,7 @@ sidebar_label: go-server
|
||||
|packageVersion|Go package version.| |1.0.0|
|
||||
|serverPort|The network port the generated server binds to| |8080|
|
||||
|sourceFolder|source folder for generated code| |go|
|
||||
|enumClassPrefix|Prefix enum with class name| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
|
||||
/*
|
||||
* Service templates. You can write services for each Api file with the apiTemplateFiles map.
|
||||
These services are skeletons built to implement the logic of your api using the
|
||||
These services are skeletons built to implement the logic of your api using the
|
||||
expected parameters and response.
|
||||
*/
|
||||
apiTemplateFiles.put(
|
||||
@ -185,6 +185,13 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
additionalProperties.put("featureCORS", corsFeatureEnabled);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ENUM_CLASS_PREFIX)) {
|
||||
setEnumClassPrefix(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.ENUM_CLASS_PREFIX).toString()));
|
||||
if (enumClassPrefix) {
|
||||
additionalProperties.put(CodegenConstants.ENUM_CLASS_PREFIX, true);
|
||||
}
|
||||
}
|
||||
|
||||
modelPackage = packageName;
|
||||
apiPackage = packageName;
|
||||
|
||||
|
@ -11,7 +11,7 @@ type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/form
|
||||
const (
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{name}} {{{classname}}} = {{{value}}}
|
||||
{{#enumClassPrefix}}{{{classname.toUpperCase}}}_{{/enumClassPrefix}}{{name}} {{{classname}}} = {{{value}}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
){{/isEnum}}{{^isEnum}}{{#description}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user