diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
index e95f9c71c4c..be8b4b74781 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java
@@ -128,6 +128,8 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiClient.cs"));
supportingFiles.add(new SupportingFile("ApiException.mustache",
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiException.cs"));
+ supportingFiles.add(new SupportingFile("ApiResponse.mustache",
+ sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiResponse.cs"));
supportingFiles.add(new SupportingFile("Newtonsoft.Json.dll", "bin", "Newtonsoft.Json.dll"));
supportingFiles.add(new SupportingFile("RestSharp.dll", "bin", "RestSharp.dll"));
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiException.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiException.mustache
index 68e3a032765..09dbd0dce50 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/ApiException.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/ApiException.mustache
@@ -1,47 +1,50 @@
using System;
-namespace {{packageName}}.Client {
- ///
- /// API Exception
- ///
- public class ApiException : Exception {
- ///
- /// Gets or sets the error code (HTTP status code)
- ///
- /// The error code (HTTP status code).
- public int ErrorCode { get; set; }
-
- ///
- /// Gets or sets the error content (body json object)
- ///
- /// The error content (Http response body).
- public dynamic ErrorContent { get; private set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public ApiException() {}
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// HTTP status code.
- /// Error message.
- public ApiException(int errorCode, string message) : base(message) {
- this.ErrorCode = errorCode;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// HTTP status code.
- /// Error message.
- /// Error content.
- public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) {
- this.ErrorCode = errorCode;
- this.ErrorContent = errorContent;
- }
-
- }
-
+namespace {{packageName}}.Client
+{
+ ///
+ /// API Exception
+ ///
+ public class ApiException : Exception
+ {
+ ///
+ /// Gets or sets the error code (HTTP status code)
+ ///
+ /// The error code (HTTP status code).
+ public int ErrorCode { get; set; }
+
+ ///
+ /// Gets or sets the error content (body json object)
+ ///
+ /// The error content (Http response body).
+ public dynamic ErrorContent { get; private set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ApiException() {}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ public ApiException(int errorCode, string message) : base(message)
+ {
+ this.ErrorCode = errorCode;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ /// Error content.
+ public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message)
+ {
+ this.ErrorCode = errorCode;
+ this.ErrorContent = errorContent;
+ }
+ }
+
}
diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
index 7a9fe4d8b09..8196bcd7ec0 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
@@ -72,7 +72,7 @@ namespace {{packageName}}.Api
/// The base path
public String GetBasePath()
{
- return this.Configuration.BasePath;
+ return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
index e3b4aad14cd..64398c599bd 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
@@ -221,7 +221,7 @@ namespace IO.Swagger.Api
/// The base path
public String GetBasePath()
{
- return this.Configuration.BasePath;
+ return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs
index 5fdd6805a2a..93ef67dae91 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs
@@ -129,7 +129,7 @@ namespace IO.Swagger.Api
/// The base path
public String GetBasePath()
{
- return this.Configuration.BasePath;
+ return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs
index cb70245d911..21905d02d1d 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs
@@ -213,7 +213,7 @@ namespace IO.Swagger.Api
/// The base path
public String GetBasePath()
{
- return this.Configuration.BasePath;
+ return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs
index addfc839716..2410626602c 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiException.cs
@@ -1,47 +1,50 @@
using System;
-namespace IO.Swagger.Client {
- ///
- /// API Exception
- ///
- public class ApiException : Exception {
- ///
- /// Gets or sets the error code (HTTP status code)
- ///
- /// The error code (HTTP status code).
- public int ErrorCode { get; set; }
-
- ///
- /// Gets or sets the error content (body json object)
- ///
- /// The error content (Http response body).
- public dynamic ErrorContent { get; private set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public ApiException() {}
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// HTTP status code.
- /// Error message.
- public ApiException(int errorCode, string message) : base(message) {
- this.ErrorCode = errorCode;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// HTTP status code.
- /// Error message.
- /// Error content.
- public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) {
- this.ErrorCode = errorCode;
- this.ErrorContent = errorContent;
- }
-
- }
-
+namespace IO.Swagger.Client
+{
+ ///
+ /// API Exception
+ ///
+ public class ApiException : Exception
+ {
+ ///
+ /// Gets or sets the error code (HTTP status code)
+ ///
+ /// The error code (HTTP status code).
+ public int ErrorCode { get; set; }
+
+ ///
+ /// Gets or sets the error content (body json object)
+ ///
+ /// The error content (Http response body).
+ public dynamic ErrorContent { get; private set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ApiException() {}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ public ApiException(int errorCode, string message) : base(message)
+ {
+ this.ErrorCode = errorCode;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ /// Error content.
+ public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message)
+ {
+ this.ErrorCode = errorCode;
+ this.ErrorContent = errorContent;
+ }
+ }
+
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs
new file mode 100644
index 00000000000..0e42375271e
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+
+namespace IO.Swagger.Client
+{
+ ///
+ /// API Response
+ ///
+ public class ApiResponse
+ {
+ ///
+ /// Gets or sets the status code (HTTP status code)
+ ///
+ /// The status code.
+ public int StatusCode { get; set; }
+
+ ///
+ /// Gets or sets the HTTP headers
+ ///
+ /// HTTP headers
+ public IDictionary Headers { get; set; }
+
+ ///
+ /// Gets or sets the data (parsed HTTP body)
+ ///
+ /// The data.
+ public T Data { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ /// Data (parsed HTTP body)
+ public ApiResponse(int statusCode, IDictionary headers, T data)
+ {
+ this.StatusCode= statusCode;
+ this.Headers = headers;
+ this.Data = data;
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs
index 79bc86118b8..151e4e42248 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs
@@ -42,12 +42,6 @@ namespace IO.Swagger.Client
/// The API client.
public ApiClient ApiClient;
- ///
- /// Gets or sets the base path.
- ///
- /// The base path
- public string BasePath { get; set; }
-
private readonly Dictionary _defaultHeaderMap = new Dictionary();
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
index 3452fb823b6..c1dc6a31e19 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
+++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj
@@ -57,6 +57,7 @@
+
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
index af6c40173eb..1f473e2ad87 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
index 52a34556bcf..b46426dfa4f 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
index af6c40173eb..1f473e2ad87 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
index 52a34556bcf..b46426dfa4f 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb differ