Fix C# client enum issue (#774)

* fix csharp enum issue

* fix numeric enum value

* add docstring to exlain isDataTypeString

* fix docstring by adding return

* fix ToJson in hash model

* remove BaseValidate for map model

* restore csproj file
This commit is contained in:
William Cheng
2018-08-11 11:34:20 +08:00
committed by GitHub
parent 21777f2759
commit ddb0920fed
31 changed files with 1316 additions and 79 deletions

View File

@@ -4577,6 +4577,14 @@ public class DefaultCodegen implements CodegenConfig {
}
}
/**
* checks if the data should be classified as "string" in enum
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
* In the future, we may rename this function to "isEnumString"
*
* @param dataType data type
* @return true if it's a enum string
*/
public boolean isDataTypeString(String dataType) {
return "String".equals(dataType);
}

View File

@@ -961,4 +961,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
public String escapeUnsafeCharacters(String input) {
return input.replace("*/", "*_/").replace("/*", "/_*").replace("--", "- -");
}
@Override
public boolean isDataTypeString(String dataType) {
// also treat double/decimal/float as "string" in enum so that the values (e.g. 2.8) get double-quoted
return "String".equalsIgnoreCase(dataType) || "double?".equals(dataType) || "decimal?".equals(dataType) || "float?".equals(dataType);
}
}

View File

@@ -7,11 +7,14 @@
[JsonConverter(typeof(StringEnumConverter))]
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for {{{value}}}
/// </summary>
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}

View File

@@ -9,11 +9,16 @@
{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for value: {{{value}}}
/// </summary>
{{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{#isString}}
[EnumMember(Value = "{{{value}}}")]
{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}{{! NOTE: This model's enumVars is modified to look like CodegenProperty}}

View File

@@ -133,7 +133,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public {{#parent}}{{^isArrayModel}}override {{/isArrayModel}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson()
public {{#parent}}{{^isArrayModel}}{{^isMapModel}}override {{/isMapModel}}{{/isArrayModel}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
@@ -247,7 +247,9 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/discriminator}}
{{#parent}}
{{^isArrayModel}}
{{^isMapModel}}
foreach(var x in BaseValidate(validationContext)) yield return x;
{{/isMapModel}}
{{/isArrayModel}}
{{/parent}}
{{#vars}}

View File

@@ -10,12 +10,17 @@
{{/isString}}
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for value: {{{value}}}
/// </summary>
{{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{#isString}}
[EnumMember(Value = "{{{value}}}")]
{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/isContainer}}

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.1-SNAPSHOT

View File

@@ -76,12 +76,12 @@ namespace Example
try
{
// To test special tags
ModelClient result = apiInstance.TestSpecialTags(modelClient);
ModelClient result = apiInstance.Call123TestSpecialTags(modelClient);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
}
}
@@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -116,6 +117,7 @@ Class | Method | HTTP request | Description
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
@@ -148,6 +150,8 @@ Class | Method | HTTP request | Description
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
- [Model.File](docs/File.md)
- [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Model.FormatTest](docs/FormatTest.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.List](docs/List.md)
@@ -164,6 +168,7 @@ Class | Method | HTTP request | Description
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.Return](docs/Return.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.StringBooleanMap](docs/StringBooleanMap.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)

View File

@@ -4,16 +4,16 @@ 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
[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
<a name="testspecialtags"></a>
# **TestSpecialTags**
> ModelClient TestSpecialTags (ModelClient modelClient)
<a name="call123testspecialtags"></a>
# **Call123TestSpecialTags**
> ModelClient Call123TestSpecialTags (ModelClient modelClient)
To test special tags
To test special tags
To test special tags and operation ID starting with number
### Example
```csharp
@@ -25,7 +25,7 @@ using Org.OpenAPITools.Model;
namespace Example
{
public class TestSpecialTagsExample
public class Call123TestSpecialTagsExample
{
public void main()
{
@@ -35,12 +35,12 @@ namespace Example
try
{
// To test special tags
ModelClient result = apiInstance.TestSpecialTags(modelClient);
ModelClient result = apiInstance.Call123TestSpecialTags(modelClient);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
}
}
}

View File

@@ -8,6 +8,7 @@ Method | HTTP request | Description
[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
[**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -256,6 +257,65 @@ No authorization required
[[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)
<a name="testbodywithfileschema"></a>
# **TestBodyWithFileSchema**
> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass)
For this test, the body for this request much reference a schema named `File`.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class TestBodyWithFileSchemaExample
{
public void main()
{
var apiInstance = new FakeApi();
var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass |
try
{
apiInstance.TestBodyWithFileSchema(fileSchemaTestClass);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)
<a name="testbodywithqueryparams"></a>
# **TestBodyWithQueryParams**
> void TestBodyWithQueryParams (string query, User user)
@@ -495,7 +555,7 @@ namespace Example
var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg)
var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional)
var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional)
var enumFormStringArray = enumFormStringArray_example; // List<string> | Form parameter enum test (string array) (optional) (default to $)
var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $)
var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg)
try
@@ -522,7 +582,7 @@ Name | Type | Description | Notes
**enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional]
**enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional]
**enumFormStringArray** | **List&lt;string&gt;**| Form parameter enum test (string array) | [optional] [default to $]
**enumFormStringArray** | [**List&lt;string&gt;**](string.md)| Form parameter enum test (string array) | [optional] [default to $]
**enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg]
### Return type

View File

@@ -0,0 +1,9 @@
# Org.OpenAPITools.Model.File
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SourceURI** | **string** | Test capitalization | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.FileSchemaTestClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**File** | **System.IO.Stream** | | [optional]
**Files** | **List&lt;System.IO.Stream&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -5,6 +5,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapMapOfString** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**MapOfEnumString** | **Dictionary&lt;string, string&gt;** | | [optional]
**DirectMap** | **Dictionary&lt;string, bool?&gt;** | | [optional]
**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -12,6 +12,7 @@ Method | HTTP request | Description
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
<a name="addpet"></a>
@@ -524,3 +525,69 @@ Name | Type | Description | Notes
[[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)
<a name="uploadfilewithrequiredfile"></a>
# **UploadFileWithRequiredFile**
> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null)
uploads an image (required)
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class UploadFileWithRequiredFileExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to update
var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
try
{
// uploads an image (required)
ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to update |
**requiredFile** | **System.IO.Stream**| file to upload |
**additionalMetadata** | **string**| Additional data to pass to server | [optional]
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **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)

View File

@@ -0,0 +1,8 @@
# Org.OpenAPITools.Model.StringBooleanMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,88 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test
{
/// <summary>
/// Class for testing FileSchemaTestClass
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class FileSchemaTestClassTests
{
// TODO uncomment below to declare an instance variable for FileSchemaTestClass
//private FileSchemaTestClass instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of FileSchemaTestClass
//instance = new FileSchemaTestClass();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of FileSchemaTestClass
/// </summary>
[Test]
public void FileSchemaTestClassInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass
//Assert.IsInstanceOfType<FileSchemaTestClass> (instance, "variable 'instance' is a FileSchemaTestClass");
}
/// <summary>
/// Test the property 'File'
/// </summary>
[Test]
public void FileTest()
{
// TODO unit test for the property 'File'
}
/// <summary>
/// Test the property 'Files'
/// </summary>
[Test]
public void FilesTest()
{
// TODO unit test for the property 'Files'
}
}
}

View File

@@ -0,0 +1,80 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test
{
/// <summary>
/// Class for testing File
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class FileTests
{
// TODO uncomment below to declare an instance variable for File
//private File instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of File
//instance = new File();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of File
/// </summary>
[Test]
public void FileInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" File
//Assert.IsInstanceOfType<File> (instance, "variable 'instance' is a File");
}
/// <summary>
/// Test the property 'SourceURI'
/// </summary>
[Test]
public void SourceURITest()
{
// TODO unit test for the property 'SourceURI'
}
}
}

View File

@@ -0,0 +1,72 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test
{
/// <summary>
/// Class for testing StringBooleanMap
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class StringBooleanMapTests
{
// TODO uncomment below to declare an instance variable for StringBooleanMap
//private StringBooleanMap instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of StringBooleanMap
//instance = new StringBooleanMap();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of StringBooleanMap
/// </summary>
[Test]
public void StringBooleanMapInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" StringBooleanMap
//Assert.IsInstanceOfType<StringBooleanMap> (instance, "variable 'instance' is a StringBooleanMap");
}
}
}

View File

@@ -28,46 +28,46 @@ namespace Org.OpenAPITools.Api
/// To test special tags
/// </summary>
/// <remarks>
/// To test special tags
/// To test special tags and operation ID starting with number
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>ModelClient</returns>
ModelClient TestSpecialTags (ModelClient modelClient);
ModelClient Call123TestSpecialTags (ModelClient modelClient);
/// <summary>
/// To test special tags
/// </summary>
/// <remarks>
/// To test special tags
/// To test special tags and operation ID starting with number
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>ApiResponse of ModelClient</returns>
ApiResponse<ModelClient> TestSpecialTagsWithHttpInfo (ModelClient modelClient);
ApiResponse<ModelClient> Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// To test special tags
/// </summary>
/// <remarks>
/// To test special tags
/// To test special tags and operation ID starting with number
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>Task of ModelClient</returns>
System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient modelClient);
System.Threading.Tasks.Task<ModelClient> Call123TestSpecialTagsAsync (ModelClient modelClient);
/// <summary>
/// To test special tags
/// </summary>
/// <remarks>
/// To test special tags
/// To test special tags and operation ID starting with number
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>Task of ApiResponse (ModelClient)</returns>
System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient);
System.Threading.Tasks.Task<ApiResponse<ModelClient>> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient);
#endregion Asynchronous Operations
}
@@ -169,28 +169,28 @@ namespace Org.OpenAPITools.Api
}
/// <summary>
/// To test special tags To test special tags
/// To test special tags To test special tags and operation ID starting with number
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>ModelClient</returns>
public ModelClient TestSpecialTags (ModelClient modelClient)
public ModelClient Call123TestSpecialTags (ModelClient modelClient)
{
ApiResponse<ModelClient> localVarResponse = TestSpecialTagsWithHttpInfo(modelClient);
ApiResponse<ModelClient> localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient);
return localVarResponse.Data;
}
/// <summary>
/// To test special tags To test special tags
/// To test special tags To test special tags and operation ID starting with number
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>ApiResponse of ModelClient</returns>
public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient)
public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient)
{
// verify the required parameter 'modelClient' is set
if (modelClient == null)
throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags");
throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags");
var localVarPath = "/another-fake/dummy";
var localVarPathParams = new Dictionary<String, String>();
@@ -233,7 +233,7 @@ namespace Org.OpenAPITools.Api
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse);
if (exception != null) throw exception;
}
@@ -243,29 +243,29 @@ namespace Org.OpenAPITools.Api
}
/// <summary>
/// To test special tags To test special tags
/// To test special tags To test special tags and operation ID starting with number
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>Task of ModelClient</returns>
public async System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient modelClient)
public async System.Threading.Tasks.Task<ModelClient> Call123TestSpecialTagsAsync (ModelClient modelClient)
{
ApiResponse<ModelClient> localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(modelClient);
ApiResponse<ModelClient> localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient);
return localVarResponse.Data;
}
/// <summary>
/// To test special tags To test special tags
/// To test special tags To test special tags and operation ID starting with number
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="modelClient">client model</param>
/// <returns>Task of ApiResponse (ModelClient)</returns>
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient)
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient)
{
// verify the required parameter 'modelClient' is set
if (modelClient == null)
throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags");
throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags");
var localVarPath = "/another-fake/dummy";
var localVarPathParams = new Dictionary<String, String>();
@@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse);
if (exception != null) throw exception;
}

View File

@@ -112,6 +112,27 @@ namespace Org.OpenAPITools.Api
///
/// </summary>
/// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns></returns>
void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass);
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass);
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -368,6 +389,27 @@ namespace Org.OpenAPITools.Api
///
/// </summary>
/// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass);
/// <summary>
///
/// </summary>
/// <remarks>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass);
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -1198,6 +1240,151 @@ namespace Org.OpenAPITools.Api
(string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string)));
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns></returns>
public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass)
{
TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass);
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>ApiResponse of Object(void)</returns>
public ApiResponse<Object> TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass)
{
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass == null)
throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema");
var localVarPath = "/fake/body-with-file-schema";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter
}
else
{
localVarPostBody = fileSchemaTestClass; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass)
{
await TestBodyWithFileSchemaAsyncWithHttpInfo(fileSchemaTestClass);
}
/// <summary>
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="fileSchemaTestClass"></param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass)
{
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass == null)
throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema");
var localVarPath = "/fake/body-with-file-schema";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter
}
else
{
localVarPostBody = fileSchemaTestClass; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
///
/// </summary>

View File

@@ -202,6 +202,31 @@ namespace Org.OpenAPITools.Api
/// <param name="file">file to upload (optional)</param>
/// <returns>ApiResponse of ApiResponse</returns>
ApiResponse<ApiResponse> UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null);
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>ApiResponse</returns>
ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null);
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>ApiResponse of ApiResponse</returns>
ApiResponse<ApiResponse> UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
@@ -382,6 +407,31 @@ namespace Org.OpenAPITools.Api
/// <param name="file">file to upload (optional)</param>
/// <returns>Task of ApiResponse (ApiResponse)</returns>
System.Threading.Tasks.Task<ApiResponse<ApiResponse>> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null);
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse> UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null);
/// <summary>
/// uploads an image (required)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>Task of ApiResponse (ApiResponse)</returns>
System.Threading.Tasks.Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null);
#endregion Asynchronous Operations
}
@@ -1700,5 +1750,170 @@ namespace Org.OpenAPITools.Api
(ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse)));
}
/// <summary>
/// uploads an image (required)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>ApiResponse</returns>
public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null)
{
ApiResponse<ApiResponse> localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata);
return localVarResponse.Data;
}
/// <summary>
/// uploads an image (required)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>ApiResponse of ApiResponse</returns>
public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null)
{
// verify the required parameter 'petId' is set
if (petId == null)
throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile");
// verify the required parameter 'requiredFile' is set
if (requiredFile == null)
throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile");
var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"multipart/form-data"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile));
// authentication (petstore_auth) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<ApiResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse)));
}
/// <summary>
/// uploads an image (required)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse> UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null)
{
ApiResponse<ApiResponse> localVarResponse = await UploadFileWithRequiredFileAsyncWithHttpInfo(petId, requiredFile, additionalMetadata);
return localVarResponse.Data;
}
/// <summary>
/// uploads an image (required)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet to update</param>
/// <param name="requiredFile">file to upload</param>
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <returns>Task of ApiResponse (ApiResponse)</returns>
public async System.Threading.Tasks.Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null)
{
// verify the required parameter 'petId' is set
if (petId == null)
throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile");
// verify the required parameter 'requiredFile' is set
if (requiredFile == null)
throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile");
var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"multipart/form-data"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile));
// authentication (petstore_auth) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<ApiResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse)));
}
}
}

View File

@@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum JustSymbolEnum
{
/// <summary>
/// Enum GreaterThanOrEqualTo for value: >=
/// </summary>
[EnumMember(Value = ">=")]
GreaterThanOrEqualTo = 1,
/// <summary>
/// Enum Dollar for value: $
/// </summary>
[EnumMember(Value = "$")]
Dollar = 2
}
/// <summary>
@@ -61,18 +61,18 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum ArrayEnumEnum
{
/// <summary>
/// Enum Fish for value: fish
/// </summary>
[EnumMember(Value = "fish")]
Fish = 1,
/// <summary>
/// Enum Crab for value: crab
/// </summary>
[EnumMember(Value = "crab")]
Crab = 2
}

View File

@@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
public enum EnumClass
{
/// <summary>
/// Enum Abc for value: _abc
/// </summary>
[EnumMember(Value = "_abc")]
Abc = 1,
/// <summary>
/// Enum Efg for value: -efg
/// </summary>
[EnumMember(Value = "-efg")]
Efg = 2,
/// <summary>
/// Enum Xyz for value: (xyz)
/// </summary>
[EnumMember(Value = "(xyz)")]
Xyz = 3
}
}

View File

@@ -36,24 +36,24 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum EnumStringEnum
{
/// <summary>
/// Enum UPPER for value: UPPER
/// </summary>
[EnumMember(Value = "UPPER")]
UPPER = 1,
/// <summary>
/// Enum Lower for value: lower
/// </summary>
[EnumMember(Value = "lower")]
Lower = 2,
/// <summary>
/// Enum Empty for value:
/// </summary>
[EnumMember(Value = "")]
Empty = 3
}
/// <summary>
@@ -67,24 +67,24 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum EnumStringRequiredEnum
{
/// <summary>
/// Enum UPPER for value: UPPER
/// </summary>
[EnumMember(Value = "UPPER")]
UPPER = 1,
/// <summary>
/// Enum Lower for value: lower
/// </summary>
[EnumMember(Value = "lower")]
Lower = 2,
/// <summary>
/// Enum Empty for value:
/// </summary>
[EnumMember(Value = "")]
Empty = 3
}
/// <summary>
@@ -97,18 +97,16 @@ namespace Org.OpenAPITools.Model
/// </summary>
public enum EnumIntegerEnum
{
/// <summary>
/// Enum NUMBER_1 for value: 1
/// </summary>
NUMBER_1 = 1,
/// <summary>
/// Enum NUMBER_MINUS_1 for value: -1
/// </summary>
NUMBER_MINUS_1 = -1
}
/// <summary>
@@ -122,18 +120,18 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum EnumNumberEnum
{
/// <summary>
/// Enum NUMBER_1_DOT_1 for value: 1.1
/// </summary>
[EnumMember(Value = "1.1")]
NUMBER_1_DOT_1 = 1,
/// <summary>
/// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2
/// </summary>
[EnumMember(Value = "-1.2")]
NUMBER_MINUS_1_DOT_2 = 2
}
/// <summary>

View File

@@ -0,0 +1,125 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Must be named &#x60;File&#x60; for test.
/// </summary>
[DataContract]
public partial class File : IEquatable<File>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="File" /> class.
/// </summary>
/// <param name="sourceURI">Test capitalization.</param>
public File(string sourceURI = default(string))
{
this.SourceURI = sourceURI;
}
/// <summary>
/// Test capitalization
/// </summary>
/// <value>Test capitalization</value>
[DataMember(Name="sourceURI", EmitDefaultValue=false)]
public string SourceURI { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class File {\n");
sb.Append(" SourceURI: ").Append(SourceURI).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as File);
}
/// <summary>
/// Returns true if File instances are equal
/// </summary>
/// <param name="input">Instance of File to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(File input)
{
if (input == null)
return false;
return
(
this.SourceURI == input.SourceURI ||
(this.SourceURI != null &&
this.SourceURI.Equals(input.SourceURI))
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.SourceURI != null)
hashCode = hashCode * 59 + this.SourceURI.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,140 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// FileSchemaTestClass
/// </summary>
[DataContract]
public partial class FileSchemaTestClass : IEquatable<FileSchemaTestClass>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="FileSchemaTestClass" /> class.
/// </summary>
/// <param name="file">file.</param>
/// <param name="files">files.</param>
public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List<System.IO.Stream> files = default(List<System.IO.Stream>))
{
this.File = file;
this.Files = files;
}
/// <summary>
/// Gets or Sets File
/// </summary>
[DataMember(Name="file", EmitDefaultValue=false)]
public System.IO.Stream File { get; set; }
/// <summary>
/// Gets or Sets Files
/// </summary>
[DataMember(Name="files", EmitDefaultValue=false)]
public List<System.IO.Stream> Files { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class FileSchemaTestClass {\n");
sb.Append(" File: ").Append(File).Append("\n");
sb.Append(" Files: ").Append(Files).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as FileSchemaTestClass);
}
/// <summary>
/// Returns true if FileSchemaTestClass instances are equal
/// </summary>
/// <param name="input">Instance of FileSchemaTestClass to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(FileSchemaTestClass input)
{
if (input == null)
return false;
return
(
this.File == input.File ||
(this.File != null &&
this.File.Equals(input.File))
) &&
(
this.Files == input.Files ||
this.Files != null &&
this.Files.SequenceEqual(input.Files)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.File != null)
hashCode = hashCode * 59 + this.File.GetHashCode();
if (this.Files != null)
hashCode = hashCode * 59 + this.Files.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum InnerEnum
{
/// <summary>
/// Enum UPPER for value: UPPER
/// </summary>
[EnumMember(Value = "UPPER")]
UPPER = 1,
/// <summary>
/// Enum Lower for value: lower
/// </summary>
[EnumMember(Value = "lower")]
Lower = 2
}
@@ -61,10 +61,14 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="mapMapOfString">mapMapOfString.</param>
/// <param name="mapOfEnumString">mapOfEnumString.</param>
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default(Dictionary<string, Dictionary<string, string>>), Dictionary<string, InnerEnum> mapOfEnumString = default(Dictionary<string, InnerEnum>))
/// <param name="directMap">directMap.</param>
/// <param name="indirectMap">indirectMap.</param>
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default(Dictionary<string, Dictionary<string, string>>), Dictionary<string, InnerEnum> mapOfEnumString = default(Dictionary<string, InnerEnum>), Dictionary<string, bool?> directMap = default(Dictionary<string, bool?>), StringBooleanMap indirectMap = default(StringBooleanMap))
{
this.MapMapOfString = mapMapOfString;
this.MapOfEnumString = mapOfEnumString;
this.DirectMap = directMap;
this.IndirectMap = indirectMap;
}
/// <summary>
@@ -74,6 +78,18 @@ namespace Org.OpenAPITools.Model
public Dictionary<string, Dictionary<string, string>> MapMapOfString { get; set; }
/// <summary>
/// Gets or Sets DirectMap
/// </summary>
[DataMember(Name="direct_map", EmitDefaultValue=false)]
public Dictionary<string, bool?> DirectMap { get; set; }
/// <summary>
/// Gets or Sets IndirectMap
/// </summary>
[DataMember(Name="indirect_map", EmitDefaultValue=false)]
public StringBooleanMap IndirectMap { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@@ -84,6 +100,8 @@ namespace Org.OpenAPITools.Model
sb.Append("class MapTest {\n");
sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n");
sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n");
sb.Append(" DirectMap: ").Append(DirectMap).Append("\n");
sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@@ -127,6 +145,16 @@ namespace Org.OpenAPITools.Model
this.MapOfEnumString == input.MapOfEnumString ||
this.MapOfEnumString != null &&
this.MapOfEnumString.SequenceEqual(input.MapOfEnumString)
) &&
(
this.DirectMap == input.DirectMap ||
this.DirectMap != null &&
this.DirectMap.SequenceEqual(input.DirectMap)
) &&
(
this.IndirectMap == input.IndirectMap ||
(this.IndirectMap != null &&
this.IndirectMap.Equals(input.IndirectMap))
);
}
@@ -143,6 +171,10 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode();
if (this.MapOfEnumString != null)
hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode();
if (this.DirectMap != null)
hashCode = hashCode * 59 + this.DirectMap.GetHashCode();
if (this.IndirectMap != null)
hashCode = hashCode * 59 + this.IndirectMap.GetHashCode();
return hashCode;
}
}

View File

@@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum
{
/// <summary>
/// Enum Placed for value: placed
/// </summary>
[EnumMember(Value = "placed")]
Placed = 1,
/// <summary>
/// Enum Approved for value: approved
/// </summary>
[EnumMember(Value = "approved")]
Approved = 2,
/// <summary>
/// Enum Delivered for value: delivered
/// </summary>
[EnumMember(Value = "delivered")]
Delivered = 3
}
/// <summary>

View File

@@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model
public enum OuterEnum
{
/// <summary>
/// Enum Placed for value: placed
/// </summary>
[EnumMember(Value = "placed")]
Placed = 1,
/// <summary>
/// Enum Approved for value: approved
/// </summary>
[EnumMember(Value = "approved")]
Approved = 2,
/// <summary>
/// Enum Delivered for value: delivered
/// </summary>
[EnumMember(Value = "delivered")]
Delivered = 3
}
}

View File

@@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum
{
/// <summary>
/// Enum Available for value: available
/// </summary>
[EnumMember(Value = "available")]
Available = 1,
/// <summary>
/// Enum Pending for value: pending
/// </summary>
[EnumMember(Value = "pending")]
Pending = 2,
/// <summary>
/// Enum Sold for value: sold
/// </summary>
[EnumMember(Value = "sold")]
Sold = 3
}
/// <summary>

View File

@@ -0,0 +1,110 @@
/*
* OpenAPI 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
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// StringBooleanMap
/// </summary>
[DataContract]
public partial class StringBooleanMap : Dictionary<String, bool?>, IEquatable<StringBooleanMap>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="StringBooleanMap" /> class.
/// </summary>
[JsonConstructorAttribute]
public StringBooleanMap() : base()
{
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class StringBooleanMap {\n");
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as StringBooleanMap);
}
/// <summary>
/// Returns true if StringBooleanMap instances are equal
/// </summary>
/// <param name="input">Instance of StringBooleanMap to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(StringBooleanMap input)
{
if (input == null)
return false;
return base.Equals(input);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = base.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}