diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
index 12e754ca6da..b13ffd3cc58 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
@@ -84,6 +84,16 @@ namespace {{packageName}}.Api
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
+ public void SetBasePath(String basePath)
+ {
+ // do nothing
+ }
///
/// Gets or sets the configuration object
@@ -91,14 +101,14 @@ namespace {{packageName}}.Api
/// An instance of the Configuration
public Configuration Configuration {get; set;}
- private readonly Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets the default header.
///
- public Dictionary DefaultHeader
+ /// Dictionary of HTTP header
+ [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
+ public Dictionary DefaultHeader()
{
- get { return _defaultHeaderMap; }
+ return this.Configuration.DefaultHeader;
}
///
@@ -107,9 +117,10 @@ namespace {{packageName}}.Api
/// Header field name.
/// Header field value.
///
+ [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap.Add(key, value);
+ this.Configuration.AddDefaultHeader(key, value);
}
{{#operation}}
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 1fb73aea079..3f9159a9e4e 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
@@ -308,6 +308,16 @@ namespace IO.Swagger.Api
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
+ public void SetBasePath(String basePath)
+ {
+ // do nothing
+ }
///
/// Gets or sets the configuration object
@@ -315,14 +325,14 @@ namespace IO.Swagger.Api
/// An instance of the Configuration
public Configuration Configuration {get; set;}
- private readonly Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets the default header.
///
- public Dictionary DefaultHeader
+ /// Dictionary of HTTP header
+ [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
+ public Dictionary DefaultHeader()
{
- get { return _defaultHeaderMap; }
+ return this.Configuration.DefaultHeader;
}
///
@@ -331,9 +341,10 @@ namespace IO.Swagger.Api
/// Header field name.
/// Header field value.
///
+ [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap.Add(key, value);
+ this.Configuration.AddDefaultHeader(key, value);
}
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 ab979c24565..a31b910c630 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
@@ -170,6 +170,16 @@ namespace IO.Swagger.Api
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
+ public void SetBasePath(String basePath)
+ {
+ // do nothing
+ }
///
/// Gets or sets the configuration object
@@ -177,14 +187,14 @@ namespace IO.Swagger.Api
/// An instance of the Configuration
public Configuration Configuration {get; set;}
- private readonly Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets the default header.
///
- public Dictionary DefaultHeader
+ /// Dictionary of HTTP header
+ [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
+ public Dictionary DefaultHeader()
{
- get { return _defaultHeaderMap; }
+ return this.Configuration.DefaultHeader;
}
///
@@ -193,9 +203,10 @@ namespace IO.Swagger.Api
/// Header field name.
/// Header field value.
///
+ [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap.Add(key, value);
+ this.Configuration.AddDefaultHeader(key, value);
}
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 06b0fe65be8..818dd135dd4 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
@@ -296,6 +296,16 @@ namespace IO.Swagger.Api
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ [Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
+ public void SetBasePath(String basePath)
+ {
+ // do nothing
+ }
///
/// Gets or sets the configuration object
@@ -303,14 +313,14 @@ namespace IO.Swagger.Api
/// An instance of the Configuration
public Configuration Configuration {get; set;}
- private readonly Dictionary _defaultHeaderMap = new Dictionary();
-
///
/// Gets the default header.
///
- public Dictionary DefaultHeader
+ /// Dictionary of HTTP header
+ [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
+ public Dictionary DefaultHeader()
{
- get { return _defaultHeaderMap; }
+ return this.Configuration.DefaultHeader;
}
///
@@ -319,9 +329,10 @@ namespace IO.Swagger.Api
/// Header field name.
/// Header field value.
///
+ [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
- _defaultHeaderMap.Add(key, value);
+ this.Configuration.AddDefaultHeader(key, value);
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
index 42cea3120fe..ff81f6b7c76 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
@@ -20,7 +20,6 @@ namespace SwaggerClient.TestApiClient
List numList = new List(new int[] {1, 37});
Assert.AreEqual("1,37", api.ParameterToString (numList));
}
-
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
index 98e9f9cefe9..6f7ef6b2812 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
@@ -242,6 +242,19 @@ namespace SwaggerClient.TestPet
Assert.AreEqual (response.Headers["Content-Type"], "application/json");
}
+ ///
+ /// Test default header (should be deprecated
+ ///
+ [Test ()]
+ public void TestDefaultHeader ()
+ {
+ PetApi petApi = new PetApi ();
+ // there should be a warning for using AddDefaultHeader (deprecated) below
+ petApi.AddDefaultHeader ("header_key", "header_value");
+ // the following should be used instead as suggested in the doc
+ petApi.Configuration.AddDefaultHeader ("header_key", "header_value");
+
+ }
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
index a58a6d610ac..86c933a1635 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 536c4f0ba9e..a86d1c82dcc 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 a58a6d610ac..86c933a1635 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 536c4f0ba9e..a86d1c82dcc 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