forked from loafle/openapi-generator-original
add option to specify c# client path in powershell generator (#5887)
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user