add option to specify c# client path in powershell generator (#5887)

This commit is contained in:
wing328
2017-06-21 00:58:29 +08:00
committed by GitHub
parent 2b8e968977
commit 8d0c7128b0
7 changed files with 20 additions and 138 deletions

View File

@@ -24,6 +24,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
protected String sourceFolder = "src";
protected String packageName = "IO.Swagger";
protected String csharpClientPath = "$ScriptDir\\csharp\\SwaggerClient";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
@@ -152,6 +153,8 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Client package name (e.g. io.swagger.client).").defaultValue(this.packageName));
cliOptions.add(new CliOption(CodegenConstants.OPTIONAL_PROJECT_GUID, "GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default."));
cliOptions.add(new CliOption("csharpClientPath", "Path to the C# API client generated by Swagger Codegen, e.g. $ScriptDir\\..\\csharp\\SwaggerClient where $ScriptDir is the current directory.").defaultValue(this.csharpClientPath));
}
public CodegenType getTag() {
@@ -170,6 +173,10 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
this.packageName = packageName;
}
public void setCsharpClientPath(String csharpClientPath) {
this.csharpClientPath = csharpClientPath;
}
public void setSourceFolder(String sourceFolder) {
this.sourceFolder = sourceFolder;
}
@@ -193,6 +200,12 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
}
if (additionalProperties.containsKey("csharpClientPath")) {
this.setCsharpClientPath((String) additionalProperties.get("csharpClientPath"));
} else {
additionalProperties.put("csharpClientPath", csharpClientPath);
}
if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
LOGGER.warn(CodegenConstants.MODEL_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
}