Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/generators/go-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public GoServerCodegen() {

/*
* 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(
Expand Down Expand Up @@ -185,6 +185,13 @@ public void processOpts() {
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down