-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ContentType selection fix for csharp. (#6633)
* ContentType selection fix for csharp. Updated to reflect java implementation. Previously any request body of type string was having the content type overridden to 'application/json'. This prevented custom json ContentTypes * updated the petshop codegen for C# * Fixed content type selection test for csharp * Replaced tabs with 4 spaces * Removed trailing space / string comparison
- Loading branch information
1 parent
be3e33f
commit ff9c723
Showing
10 changed files
with
1,018 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
samples/client/petstore/csharp/SwaggerClient/docs/AnotherFakeApi.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# IO.Swagger.Api.AnotherFakeApi | ||
|
||
All URIs are relative to *http://petstore.swagger.io:80/v2* | ||
|
||
Method | HTTP request | Description | ||
------------- | ------------- | ------------- | ||
[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags | ||
|
||
|
||
<a name="testspecialtags"></a> | ||
# **TestSpecialTags** | ||
> ModelClient TestSpecialTags (ModelClient body) | ||
To test special tags | ||
|
||
To test special tags | ||
|
||
### Example | ||
```csharp | ||
using System; | ||
using System.Diagnostics; | ||
using IO.Swagger.Api; | ||
using IO.Swagger.Client; | ||
using IO.Swagger.Model; | ||
|
||
namespace Example | ||
{ | ||
public class TestSpecialTagsExample | ||
{ | ||
public void main() | ||
{ | ||
var apiInstance = new AnotherFakeApi(); | ||
var body = new ModelClient(); // ModelClient | client model | ||
try | ||
{ | ||
// To test special tags | ||
ModelClient result = apiInstance.TestSpecialTags(body); | ||
Debug.WriteLine(result); | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Parameters | ||
|
||
Name | Type | Description | Notes | ||
------------- | ------------- | ------------- | ------------- | ||
**body** | [**ModelClient**](ModelClient.md)| client model | | ||
|
||
### Return type | ||
|
||
[**ModelClient**](ModelClient.md) | ||
|
||
### Authorization | ||
|
||
No authorization required | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | ||
|
73 changes: 73 additions & 0 deletions
73
samples/client/petstore/csharp/SwaggerClient/docs/FakeClassnameTags123Api.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# IO.Swagger.Api.FakeClassnameTags123Api | ||
|
||
All URIs are relative to *http://petstore.swagger.io:80/v2* | ||
|
||
Method | HTTP request | Description | ||
------------- | ------------- | ------------- | ||
[**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case | ||
|
||
|
||
<a name="testclassname"></a> | ||
# **TestClassname** | ||
> ModelClient TestClassname (ModelClient body) | ||
To test class name in snake case | ||
|
||
### Example | ||
```csharp | ||
using System; | ||
using System.Diagnostics; | ||
using IO.Swagger.Api; | ||
using IO.Swagger.Client; | ||
using IO.Swagger.Model; | ||
|
||
namespace Example | ||
{ | ||
public class TestClassnameExample | ||
{ | ||
public void main() | ||
{ | ||
// Configure API key authorization: api_key_query | ||
Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); | ||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed | ||
// Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); | ||
var apiInstance = new FakeClassnameTags123Api(); | ||
var body = new ModelClient(); // ModelClient | client model | ||
try | ||
{ | ||
// To test class name in snake case | ||
ModelClient result = apiInstance.TestClassname(body); | ||
Debug.WriteLine(result); | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message ); | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Parameters | ||
|
||
Name | Type | Description | Notes | ||
------------- | ------------- | ------------- | ------------- | ||
**body** | [**ModelClient**](ModelClient.md)| client model | | ||
|
||
### Return type | ||
|
||
[**ModelClient**](ModelClient.md) | ||
|
||
### Authorization | ||
|
||
[api_key_query](../README.md#api_key_query) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | ||
|
81 changes: 81 additions & 0 deletions
81
samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/AnotherFakeApiTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Swagger Petstore | ||
* | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: apiteam@swagger.io | ||
* Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Reflection; | ||
using RestSharp; | ||
using NUnit.Framework; | ||
|
||
using IO.Swagger.Client; | ||
using IO.Swagger.Api; | ||
using IO.Swagger.Model; | ||
|
||
namespace IO.Swagger.Test | ||
{ | ||
/// <summary> | ||
/// Class for testing AnotherFakeApi | ||
/// </summary> | ||
/// <remarks> | ||
/// This file is automatically generated by Swagger Codegen. | ||
/// Please update the test case below to test the API endpoint. | ||
/// </remarks> | ||
[TestFixture] | ||
public class AnotherFakeApiTests | ||
{ | ||
private AnotherFakeApi instance; | ||
|
||
/// <summary> | ||
/// Setup before each unit test | ||
/// </summary> | ||
[SetUp] | ||
public void Init() | ||
{ | ||
instance = new AnotherFakeApi(); | ||
} | ||
|
||
/// <summary> | ||
/// Clean up after each unit test | ||
/// </summary> | ||
[TearDown] | ||
public void Cleanup() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Test an instance of AnotherFakeApi | ||
/// </summary> | ||
[Test] | ||
public void InstanceTest() | ||
{ | ||
// TODO uncomment below to test 'IsInstanceOfType' AnotherFakeApi | ||
//Assert.IsInstanceOfType(typeof(AnotherFakeApi), instance, "instance is a AnotherFakeApi"); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Test TestSpecialTags | ||
/// </summary> | ||
[Test] | ||
public void TestSpecialTagsTest() | ||
{ | ||
// TODO uncomment below to test the method and replace null with proper value | ||
//ModelClient body = null; | ||
//var response = instance.TestSpecialTags(body); | ||
//Assert.IsInstanceOf<ModelClient> (response, "response is ModelClient"); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.