Skip to content

Commit

Permalink
remove default format (json) from c# api (#4980)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Mar 8, 2017
1 parent d21e156 commit b6d6356
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@ namespace {{packageName}}.{{apiPackage}}
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
{{#pathParams}}
if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
{{/pathParams}}
Expand Down Expand Up @@ -368,9 +365,6 @@ namespace {{packageName}}.{{apiPackage}}
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
{{#pathParams}}
if ({{paramName}} != null) localVarPathParams.Add("{{baseName}}", Configuration.ApiClient.ParameterToString({{paramName}})); // path parameter
{{/pathParams}}
Expand Down
10 changes: 5 additions & 5 deletions samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{45175ABF-4F24-48D0-B481-B1A2D9B8649E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D445A874-7512-4B21-AC14-0CC1180C9B9A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
Expand All @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Release|Any CPU.Build.0 = Release|Any CPU
{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D445A874-7512-4B21-AC14-0CC1180C9B9A}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/csharp/SwaggerClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
- [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 recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,6 @@ public ApiResponse< ModelClient > TestClientModelWithHttpInfo (ModelClient body)
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -469,9 +466,6 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -583,9 +577,6 @@ public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal? number,
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter
if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter
if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter
Expand Down Expand Up @@ -711,9 +702,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParame
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter
if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter
if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter
Expand Down Expand Up @@ -811,9 +799,6 @@ public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumForm
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (enumQueryStringArray != null) localVarQueryParams.Add("enum_query_string_array", Configuration.ApiClient.ParameterToString(enumQueryStringArray)); // query parameter
if (enumQueryString != null) localVarQueryParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // query parameter
if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter
Expand Down Expand Up @@ -900,9 +885,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParameters
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (enumQueryStringArray != null) localVarQueryParams.Add("enum_query_string_array", Configuration.ApiClient.ParameterToString(enumQueryStringArray)); // query parameter
if (enumQueryString != null) localVarQueryParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // query parameter
if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,6 @@ public ApiResponse<Object> AddPetWithHttpInfo (Pet body)
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -627,9 +624,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> AddPetAsyncWithHtt
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -712,9 +706,6 @@ public ApiResponse<Object> DeletePetWithHttpInfo (long? petId, string apiKey = n
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (apiKey != null) localVarHeaderParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter

Expand Down Expand Up @@ -792,9 +783,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> DeletePetAsyncWith
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (apiKey != null) localVarHeaderParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter

Expand Down Expand Up @@ -870,9 +858,6 @@ public ApiResponse< List<Pet> > FindPetsByStatusWithHttpInfo (List<string> statu
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter

// authentication (petstore_auth) required
Expand Down Expand Up @@ -948,9 +933,6 @@ public async System.Threading.Tasks.Task<ApiResponse<List<Pet>>> FindPetsByStatu
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter

// authentication (petstore_auth) required
Expand Down Expand Up @@ -1025,9 +1007,6 @@ public ApiResponse< List<Pet> > FindPetsByTagsWithHttpInfo (List<string> tags)
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (tags != null) localVarQueryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter

// authentication (petstore_auth) required
Expand Down Expand Up @@ -1103,9 +1082,6 @@ public async System.Threading.Tasks.Task<ApiResponse<List<Pet>>> FindPetsByTagsA
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (tags != null) localVarQueryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter

// authentication (petstore_auth) required
Expand Down Expand Up @@ -1180,9 +1156,6 @@ public ApiResponse< Pet > GetPetByIdWithHttpInfo (long? petId)
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter

// authentication (api_key) required
Expand Down Expand Up @@ -1258,9 +1231,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Pet>> GetPetByIdAsyncWithHt
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter

// authentication (api_key) required
Expand Down Expand Up @@ -1335,9 +1305,6 @@ public ApiResponse<Object> UpdatePetWithHttpInfo (Pet body)
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -1421,9 +1388,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> UpdatePetAsyncWith
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (body != null && body.GetType() != typeof(byte[]))
{
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
Expand Down Expand Up @@ -1509,9 +1473,6 @@ public ApiResponse<Object> UpdatePetWithFormWithHttpInfo (long? petId, string na
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (name != null) localVarFormParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter
if (status != null) localVarFormParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter
Expand Down Expand Up @@ -1593,9 +1554,6 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> UpdatePetWithFormA
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (name != null) localVarFormParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter
if (status != null) localVarFormParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter
Expand Down Expand Up @@ -1676,9 +1634,6 @@ public ApiResponse< ApiResponse > UploadFileWithHttpInfo (long? petId, string ad
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (file != null) localVarFileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file));
Expand Down Expand Up @@ -1760,9 +1715,6 @@ public async System.Threading.Tasks.Task<ApiResponse<ApiResponse>> UploadFileAsy
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (file != null) localVarFileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file));
Expand Down
Loading

0 comments on commit b6d6356

Please sign in to comment.