update csharp reserved words with local variable names in api methods

This commit is contained in:
wing328 2016-01-06 23:08:08 +08:00
parent 22b5f02ec3
commit eeaf832cae
13 changed files with 31 additions and 179 deletions

View File

@ -45,7 +45,20 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
reservedWords = new HashSet<String>( reservedWords = new HashSet<String>(
Arrays.asList( Arrays.asList(
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while") // local variable names in API methods (endpoints)
"path_", "pathParams", "queryParams", "headerParams", "formParams", "fileParams",
"postBody", "http_header_accepts", "http_header_accept", "apiKeyValue", "response",
"statusCode",
// C# reserved words
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked",
"class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else",
"enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for",
"foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock",
"long", "namespace", "new", "null", "object", "operator", "out", "override", "params",
"private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed",
"short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw",
"true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using",
"virtual", "void", "volatile", "while")
); );

View File

@ -307,42 +307,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns> /// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> DeletePetAsyncWithHttpInfo (long? petId, string apiKey = null); System.Threading.Tasks.Task<ApiResponse<Object>> DeletePetAsyncWithHttpInfo (long? petId, string apiKey = null);
/// <summary>
/// downloads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>Stream</returns>
Stream DownloadFile ();
/// <summary>
/// downloads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>ApiResponse of Stream</returns>
ApiResponse<Stream> DownloadFileWithHttpInfo ();
/// <summary>
/// downloads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>Task of Stream</returns>
System.Threading.Tasks.Task<Stream> DownloadFileAsync ();
/// <summary>
/// downloads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>Task of ApiResponse (Stream)</returns>
System.Threading.Tasks.Task<ApiResponse<Stream>> DownloadFileAsyncWithHttpInfo ();
/// <summary> /// <summary>
/// uploads an image /// uploads an image
/// </summary> /// </summary>
@ -1523,131 +1487,6 @@ namespace IO.Swagger.Api
null); null);
} }
/// <summary>
/// downloads an image
/// </summary>
/// <returns>Stream</returns>
public Stream DownloadFile ()
{
ApiResponse<Stream> response = DownloadFileWithHttpInfo();
return response.Data;
}
/// <summary>
/// downloads an image
/// </summary>
/// <returns>ApiResponse of Stream</returns>
public ApiResponse< Stream > DownloadFileWithHttpInfo ()
{
var path_ = "/pet/{petId}/downloadImage";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>();
String postBody = null;
// to determine the Accept header
String[] http_header_accepts = new String[] {
"application/octet-stream"
};
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
if (http_header_accept != null)
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
pathParams.Add("format", "json");
// make the HTTP request
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
int statusCode = (int) response.StatusCode;
if (statusCode >= 400)
throw new ApiException (statusCode, "Error calling DownloadFile: " + response.Content, response.Content);
else if (statusCode == 0)
throw new ApiException (statusCode, "Error calling DownloadFile: " + response.ErrorMessage, response.ErrorMessage);
return new ApiResponse<Stream>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Stream) Configuration.ApiClient.Deserialize(response, typeof(Stream)));
}
/// <summary>
/// downloads an image
/// </summary>
/// <returns>Task of Stream</returns>
public async System.Threading.Tasks.Task<Stream> DownloadFileAsync ()
{
ApiResponse<Stream> response = await DownloadFileAsyncWithHttpInfo();
return response.Data;
}
/// <summary>
/// downloads an image
/// </summary>
/// <returns>Task of ApiResponse (Stream)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Stream>> DownloadFileAsyncWithHttpInfo ()
{
var path_ = "/pet/{petId}/downloadImage";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>();
String postBody = null;
// to determine the Accept header
String[] http_header_accepts = new String[] {
"application/octet-stream"
};
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
if (http_header_accept != null)
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
pathParams.Add("format", "json");
// make the HTTP request
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
int statusCode = (int) response.StatusCode;
if (statusCode >= 400)
throw new ApiException (statusCode, "Error calling DownloadFile: " + response.Content, response.Content);
else if (statusCode == 0)
throw new ApiException (statusCode, "Error calling DownloadFile: " + response.ErrorMessage, response.ErrorMessage);
return new ApiResponse<Stream>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Stream) Configuration.ApiClient.Deserialize(response, typeof(Stream)));
}
/// <summary> /// <summary>
/// uploads an image /// uploads an image
/// </summary> /// </summary>

View File

@ -2,9 +2,9 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs">
<Files> <Files>
<File FileName="TestConfiguration.cs" Line="17" Column="33" /> <File FileName="TestConfiguration.cs" Line="1" Column="1" />
<File FileName="TestPet.cs" Line="81" Column="17" /> <File FileName="TestPet.cs" Line="1" Column="1" />
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs" Line="12" Column="18" /> <File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs" Line="15" Column="29" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>

View File

@ -1,9 +1,9 @@
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll /Users/williamcheng/Code/tmp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll