-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C#] ContentType selection fix #6633
Merged
wing328
merged 5 commits into
swagger-api:master
from
Certica-StateSolutions:issue-6629
Oct 17, 2017
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8a11238
ContentType selection fix for csharp.
alex-fisher 7c894ae
updated the petshop codegen for C#
750be46
Fixed content type selection test for csharp
alex-fisher 8abadc8
Replaced tabs with 4 spaces
alex-fisher 0d03a7c
Removed trailing space / string comparison
alex-fisher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check previously existed to support file inputs. Can you verify your change works when posting files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jimschubert I implemented the 'UploadFile' test for the generated Petstore csharp api solution. The test passed and the api response was a 200. Let me know if there is any further testing you would like me to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex-fisher I don't see that in this PR. Is it on another branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done in the tests generated by the sdk and not in the actual testing suite. Would you like me to add a permanent test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it repeatable? If you share it here as a snippet, we can evaluate and either add it to this pr or to a later pr. It would be ideal as a permanent test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any further investigation I can do on my part for this request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add back the tests shortly. Stay tuned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests added back #6663
Please rebase on the latest master to add the tests to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for taking that down. I've had a rough week and not much time after work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worry :)