mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-24 17:09:13 +00:00
[Golang][client] Allow generating go client code as a submodule. (#3012)
This commit is contained in:
committed by
William Cheng
parent
9f1b9386f1
commit
66bf0dce9e
@@ -69,6 +69,9 @@ public class CodegenConstants {
|
||||
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
|
||||
public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs";
|
||||
|
||||
public static final String IS_GO_SUBMODULE = "isGoSubmodule";
|
||||
public static final String IS_GO_SUBMODULE_DESC = "whether the generated Go module is a submodule";
|
||||
|
||||
public static final String GROUP_ID = "groupId";
|
||||
public static final String GROUP_ID_DESC = "groupId in generated pom.xml";
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
protected String packageVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected boolean isGoSubmodule = false;
|
||||
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
|
||||
public static final String WITH_XML = "withXml";
|
||||
|
||||
@@ -51,6 +52,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
// default HIDE_GENERATION_TIMESTAMP to true
|
||||
hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs"));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
|
||||
|
||||
@@ -111,6 +113,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
additionalProperties.put(WITH_XML, "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) {
|
||||
setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString()));
|
||||
if (isGoSubmodule) {
|
||||
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,4 +193,8 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
this.packageVersion = packageVersion;
|
||||
}
|
||||
|
||||
public void setIsGoSubmodule(boolean isGoSubmodule) {
|
||||
this.isGoSubmodule = isGoSubmodule;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user