diff --git a/bin/powershell-petstore.sh b/bin/powershell-petstore.sh
index 977a4147cb3..6e4c9b533aa 100755
--- a/bin/powershell-petstore.sh
+++ b/bin/powershell-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="generate -t modules/swagger-codegen/src/main/resources/powershell -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell_test --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5 $@"
+ags="generate -t modules/swagger-codegen/src/main/resources/powershell -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell_test --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=\$ScriptDir\..\..\petstore\csharp\SwaggerClient $@"
java ${JAVA_OPTS} -jar ${executable} ${ags}
diff --git a/bin/windows/powershell-petsstore.bat b/bin/windows/powershell-petsstore.bat
index 0a066b8ae48..da7b0f61e03 100644
--- a/bin/windows/powershell-petsstore.bat
+++ b/bin/windows/powershell-petsstore.bat
@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
-set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l powershell -o samples\client\petstore\powershell
+set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l powershell -o samples\client\petstore\powershell --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,csharpClientPath=$ScriptDir\..\..\petstore\csharp\SwaggerClient
java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java
index e884828fccc..dcacc549406 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PowerShellClientCodegen.java
@@ -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.");
}
diff --git a/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache b/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache
index fb71a543014..4cb78dce827 100644
--- a/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache
+++ b/modules/swagger-codegen/src/main/resources/powershell/Build.ps1.mustache
@@ -38,7 +38,7 @@ function Get-FunctionsToExport {
}
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
-$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath
+$ClientPath = ("{{{csharpClientPath}}}" | Resolve-Path).ProviderPath
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\{{{packageName}}}\" $_}
$BinPath = "$ScriptDir\src\{{{packageName}}}\Bin"
diff --git a/modules/swagger-codegen/src/main/resources/powershell/README.mustache b/modules/swagger-codegen/src/main/resources/powershell/README.mustache
index 76dc67b7d79..e1351f54373 100644
--- a/modules/swagger-codegen/src/main/resources/powershell/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/powershell/README.mustache
@@ -18,21 +18,11 @@ This PowerShell module is automatically generated by the [Swagger Codegen](https
## Frameworks supported
-- .NET 4.0 or later
- PowerShell 3.0 or later
## Dependencies
-- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
-- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
-
-The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
-```
-Install-Package RestSharp
-Install-Package Newtonsoft.Json
-```
-
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+- C# API client generated by Swagger Codegen AND should be located in {{{csharpClientPath}}} as stated in Build.ps1
## Installation
@@ -46,54 +36,3 @@ using {{packageName}}.Client;
using {{packageName}}.{{modelPackage}};
```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *{{{basePath}}}*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
-{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
-
-
-## Documentation for Models
-
-{{#modelPackage}}
-{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
-{{/model}}{{/models}}
-{{/modelPackage}}
-{{^modelPackage}}
-No model defined in this package
-{{/modelPackage}}
-
-
-## Documentation for Authorization
-
-{{^authMethods}}
-All endpoints do not require authorization.
-{{/authMethods}}
-{{#authMethods}}
-{{#last}}
-Authentication schemes defined for the API:
-{{/last}}
-{{/authMethods}}
-{{#authMethods}}
-
-### {{name}}
-
-{{#isApiKey}}- **Type**: API key
-- **API key parameter name**: {{keyParamName}}
-- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
-{{/isApiKey}}
-{{#isBasic}}- **Type**: HTTP basic authentication
-{{/isBasic}}
-{{#isOAuth}}- **Type**: OAuth
-- **Flow**: {{flow}}
-- **Authorization URL**: {{authorizationUrl}}
-- **Scopes**: {{^scopes}}N/A{{/scopes}}
-{{#scopes}} - {{scope}}: {{description}}
-{{/scopes}}
-{{/isOAuth}}
-
-{{/authMethods}}
diff --git a/samples/client/petstore/powershell_test/README.md b/samples/client/petstore/powershell_test/README.md
index 75f5add565a..eed57643045 100644
--- a/samples/client/petstore/powershell_test/README.md
+++ b/samples/client/petstore/powershell_test/README.md
@@ -6,26 +6,16 @@ This PowerShell module is automatically generated by the [Swagger Codegen](https
- API version: 1.0.0
- SDK version:
-- Build date: 2017-06-20T16:12:54.727+08:00
+- Build date: 2017-06-20T22:49:00.415+08:00
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
## Frameworks supported
-- .NET 4.0 or later
- PowerShell 3.0 or later
## Dependencies
-- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
-- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
-
-The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
-```
-Install-Package RestSharp
-Install-Package Newtonsoft.Json
-```
-
-NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
+- C# API client generated by Swagger Codegen AND should be located in $ScriptDir\..\..\petstore\csharp\SwaggerClient as stated in Build.ps1
## Installation
@@ -39,63 +29,3 @@ using IO.Swagger.Client;
using IO.Swagger.IO.Swagger/Model;
```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *http://petstore.swagger.io/v2*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
-*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
-*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
-*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
-*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
-*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
-*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
-*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
-*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
-*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
-*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
-*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
-*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
-*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
-*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
-*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
-*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
-*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
-*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
-*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
-
-
-
-## Documentation for Models
-
- - [IO.Swagger/Model.ApiResponse](docs/ApiResponse.md)
- - [IO.Swagger/Model.Category](docs/Category.md)
- - [IO.Swagger/Model.Order](docs/Order.md)
- - [IO.Swagger/Model.Pet](docs/Pet.md)
- - [IO.Swagger/Model.Tag](docs/Tag.md)
- - [IO.Swagger/Model.User](docs/User.md)
-
-
-
-## Documentation for Authorization
-
-
-### api_key
-
-- **Type**: API key
-- **API key parameter name**: api_key
-- **Location**: HTTP header
-
-
-### petstore_auth
-
-- **Type**: OAuth
-- **Flow**: implicit
-- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
-- **Scopes**:
- - write:pets: modify pets in your account
- - read:pets: read your pets
-
diff --git a/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt b/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt
index 4233d622cac..d598279543b 100644
--- a/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt
+++ b/samples/client/petstore/powershell_test/src/IO.Swagger/en-US/about_IO.Swagger.help.txt
@@ -11,7 +11,7 @@ LONG DESCRIPTION
- API version: 1.0.0
- SDK version:
- - Build date: 2017-06-20T16:12:54.727+08:00
+ - Build date: 2017-06-20T22:49:00.415+08:00
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
Frameworks supported: