[docs] Fix go-gin-server additional property docs. (#7188)

* [docs] Fix go-gin-server additional property docs.

* add cli option for serverPort, apiPath

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
taqm 2020-08-24 15:19:23 +09:00 committed by GitHub
parent c893b92775
commit 3e734a0b54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -5,9 +5,11 @@ sidebar_label: go-gin-server
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|apiPath|Name of the folder that contains the Go source code| |go|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi| |packageName|Go package name (convention: lowercase).| |openapi|
|packageVersion|Go package version.| |1.0.0| |packageVersion|Go package version.| |1.0.0|
|serverPort|The network port the generated server binds to| |8080|
## IMPORT MAPPING ## IMPORT MAPPING

View File

@ -16,6 +16,7 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.CodegenType;
@ -107,6 +108,14 @@ public class GoGinServerCodegen extends AbstractGoCodegen {
"continue", "for", "import", "return", "var", "error", "nil") "continue", "for", "import", "return", "var", "error", "nil")
// Added "error" as it's used so frequently that it may as well be a keyword // Added "error" as it's used so frequently that it may as well be a keyword
); );
cliOptions.add(new CliOption("apiPath", "Name of the folder that contains the Go source code")
.defaultValue(apiPath));
CliOption optServerPort = new CliOption("serverPort", "The network port the generated server binds to");
optServerPort.setType("int");
optServerPort.defaultValue(Integer.toString(serverPort));
cliOptions.add(optServerPort);
} }
@Override @Override