forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/6.3.x' into 7.0.x
This commit is contained in:
@@ -98,6 +98,9 @@ src/Org.OpenAPITools/Api/UserApi.cs
|
||||
src/Org.OpenAPITools/Client/ApiClient.cs
|
||||
src/Org.OpenAPITools/Client/ApiException.cs
|
||||
src/Org.OpenAPITools/Client/ApiResponse.cs
|
||||
src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs
|
||||
src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs
|
||||
src/Org.OpenAPITools/Client/Auth/TokenResponse.cs
|
||||
src/Org.OpenAPITools/Client/ClientUtils.cs
|
||||
src/Org.OpenAPITools/Client/Configuration.cs
|
||||
src/Org.OpenAPITools/Client/ExceptionFactory.cs
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<string>** | | [optional]
|
||||
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [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)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, string>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional]
|
||||
**DirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
**IndirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
// TODO uncomment below to test the method and replace null with proper value
|
||||
//var response = instance.FooGet();
|
||||
//Assert.IsType<InlineResponseDefault>(response);
|
||||
//Assert.IsType<FooGetDefaultResponse>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<Animal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Cat from type Animal
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a Cat from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'ClassName'
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<GrandparentAnimal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ChildCat from type ParentPet
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a ChildCat from type ParentPet
|
||||
//Assert.IsType<ParentPet>(JsonConvert.DeserializeObject<ParentPet>(new ChildCat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'PetType'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Org.OpenAPITools.Model;
|
||||
using Org.OpenAPITools.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
@@ -674,9 +675,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -769,9 +780,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -844,9 +865,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -921,9 +952,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1015,9 +1056,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1111,9 +1162,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1207,9 +1268,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1305,9 +1376,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1542,9 +1623,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1637,9 +1728,19 @@ namespace Org.OpenAPITools.Api
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1719,9 +1820,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1803,9 +1914,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1887,9 +2008,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -1973,9 +2104,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -2061,9 +2202,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
@@ -2151,9 +2302,19 @@ namespace Org.OpenAPITools.Api
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
if (!string.IsNullOrEmpty(this.Configuration.AccessToken))
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) &&
|
||||
this.Configuration.OAuthFlow != null)
|
||||
{
|
||||
localVarRequestOptions.OAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Org.OpenAPITools.Client;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
using Org.OpenAPITools.Model;
|
||||
|
||||
namespace Org.OpenAPITools.Api
|
||||
|
||||
@@ -24,18 +24,18 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
using RestSharp;
|
||||
using RestSharp.Deserializers;
|
||||
using RestSharp.Serializers;
|
||||
using RestSharpMethod = RestSharp.Method;
|
||||
using Polly;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
|
||||
namespace Org.OpenAPITools.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON.
|
||||
/// </summary>
|
||||
internal class CustomJsonCodec : RestSharp.Serializers.ISerializer, RestSharp.Deserializers.IDeserializer
|
||||
internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer
|
||||
{
|
||||
private readonly IReadableConfiguration _configuration;
|
||||
private static readonly string _contentType = "application/json";
|
||||
@@ -81,7 +81,9 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
}
|
||||
|
||||
public T Deserialize<T>(IRestResponse response)
|
||||
public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value);
|
||||
|
||||
public T Deserialize<T>(RestResponse response)
|
||||
{
|
||||
var result = (T)Deserialize(response, typeof(T));
|
||||
return result;
|
||||
@@ -93,7 +95,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <param name="response">The HTTP response.</param>
|
||||
/// <param name="type">Object type.</param>
|
||||
/// <returns>Object representation of the JSON string.</returns>
|
||||
internal object Deserialize(IRestResponse response, Type type)
|
||||
internal object Deserialize(RestResponse response, Type type)
|
||||
{
|
||||
if (type == typeof(byte[])) // return byte array
|
||||
{
|
||||
@@ -146,15 +148,22 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
}
|
||||
|
||||
public string RootElement { get; set; }
|
||||
public string Namespace { get; set; }
|
||||
public string DateFormat { get; set; }
|
||||
public ISerializer Serializer => this;
|
||||
public IDeserializer Deserializer => this;
|
||||
|
||||
public string[] AcceptedContentTypes => RestSharp.Serializers.ContentType.JsonAccept;
|
||||
|
||||
public SupportsContentType SupportsContentType => contentType =>
|
||||
contentType.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
contentType.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get { return _contentType; }
|
||||
set { throw new InvalidOperationException("Not allowed to set content type."); }
|
||||
}
|
||||
|
||||
public DataFormat DataFormat => DataFormat.Json;
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementations),
|
||||
@@ -185,14 +194,14 @@ namespace Org.OpenAPITools.Client
|
||||
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
|
||||
/// </summary>
|
||||
/// <param name="request">The RestSharp request object</param>
|
||||
partial void InterceptRequest(IRestRequest request);
|
||||
partial void InterceptRequest(RestRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
|
||||
/// </summary>
|
||||
/// <param name="request">The RestSharp request object</param>
|
||||
/// <param name="response">The RestSharp response object</param>
|
||||
partial void InterceptResponse(IRestRequest request, IRestResponse response);
|
||||
partial void InterceptResponse(RestRequest request, RestResponse response);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
|
||||
@@ -227,25 +236,25 @@ namespace Org.OpenAPITools.Client
|
||||
switch (method)
|
||||
{
|
||||
case HttpMethod.Get:
|
||||
other = RestSharpMethod.GET;
|
||||
other = RestSharpMethod.Get;
|
||||
break;
|
||||
case HttpMethod.Post:
|
||||
other = RestSharpMethod.POST;
|
||||
other = RestSharpMethod.Post;
|
||||
break;
|
||||
case HttpMethod.Put:
|
||||
other = RestSharpMethod.PUT;
|
||||
other = RestSharpMethod.Put;
|
||||
break;
|
||||
case HttpMethod.Delete:
|
||||
other = RestSharpMethod.DELETE;
|
||||
other = RestSharpMethod.Delete;
|
||||
break;
|
||||
case HttpMethod.Head:
|
||||
other = RestSharpMethod.HEAD;
|
||||
other = RestSharpMethod.Head;
|
||||
break;
|
||||
case HttpMethod.Options:
|
||||
other = RestSharpMethod.OPTIONS;
|
||||
other = RestSharpMethod.Options;
|
||||
break;
|
||||
case HttpMethod.Patch:
|
||||
other = RestSharpMethod.PATCH;
|
||||
other = RestSharpMethod.Patch;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("method", method, null);
|
||||
@@ -276,11 +285,7 @@ namespace Org.OpenAPITools.Client
|
||||
if (options == null) throw new ArgumentNullException("options");
|
||||
if (configuration == null) throw new ArgumentNullException("configuration");
|
||||
|
||||
RestRequest request = new RestRequest(Method(method))
|
||||
{
|
||||
Resource = path,
|
||||
JsonSerializer = new CustomJsonCodec(SerializerSettings, configuration)
|
||||
};
|
||||
RestRequest request = new RestRequest(path, Method(method));
|
||||
|
||||
if (options.PathParameters != null)
|
||||
{
|
||||
@@ -375,25 +380,17 @@ namespace Org.OpenAPITools.Client
|
||||
var bytes = ClientUtils.ReadAsBytes(file);
|
||||
var fileStream = file as FileStream;
|
||||
if (fileStream != null)
|
||||
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)));
|
||||
request.AddFile(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name));
|
||||
else
|
||||
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"));
|
||||
request.AddFile(fileParam.Key, bytes, "no_file_name_provided");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.Cookies != null && options.Cookies.Count > 0)
|
||||
{
|
||||
foreach (var cookie in options.Cookies)
|
||||
{
|
||||
request.AddCookie(cookie.Name, cookie.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
private ApiResponse<T> ToApiResponse<T>(IRestResponse<T> response)
|
||||
private ApiResponse<T> ToApiResponse<T>(RestResponse<T> response)
|
||||
{
|
||||
T result = response.Data;
|
||||
string rawContent = response.Content;
|
||||
@@ -412,9 +409,17 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
}
|
||||
|
||||
if (response.ContentHeaders != null)
|
||||
{
|
||||
foreach (var responseHeader in response.ContentHeaders)
|
||||
{
|
||||
transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value));
|
||||
}
|
||||
}
|
||||
|
||||
if (response.Cookies != null)
|
||||
{
|
||||
foreach (var responseCookies in response.Cookies)
|
||||
foreach (var responseCookies in response.Cookies.Cast<Cookie>())
|
||||
{
|
||||
transformed.Cookies.Add(
|
||||
new Cookie(
|
||||
@@ -432,54 +437,46 @@ namespace Org.OpenAPITools.Client
|
||||
private ApiResponse<T> Exec<T>(RestRequest req, RequestOptions options, IReadableConfiguration configuration)
|
||||
{
|
||||
var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl;
|
||||
RestClient client = new RestClient(baseUrl);
|
||||
|
||||
client.ClearHandlers();
|
||||
var existingDeserializer = req.JsonSerializer as IDeserializer;
|
||||
if (existingDeserializer != null)
|
||||
var cookies = new CookieContainer();
|
||||
|
||||
if (options.Cookies != null && options.Cookies.Count > 0)
|
||||
{
|
||||
client.AddHandler("application/json", () => existingDeserializer);
|
||||
client.AddHandler("text/json", () => existingDeserializer);
|
||||
client.AddHandler("text/x-json", () => existingDeserializer);
|
||||
client.AddHandler("text/javascript", () => existingDeserializer);
|
||||
client.AddHandler("*+json", () => existingDeserializer);
|
||||
}
|
||||
else
|
||||
{
|
||||
var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration);
|
||||
client.AddHandler("application/json", () => customDeserializer);
|
||||
client.AddHandler("text/json", () => customDeserializer);
|
||||
client.AddHandler("text/x-json", () => customDeserializer);
|
||||
client.AddHandler("text/javascript", () => customDeserializer);
|
||||
client.AddHandler("*+json", () => customDeserializer);
|
||||
foreach (var cookie in options.Cookies)
|
||||
{
|
||||
cookies.Add(new Cookie(cookie.Name, cookie.Value));
|
||||
}
|
||||
}
|
||||
|
||||
var xmlDeserializer = new XmlDeserializer();
|
||||
client.AddHandler("application/xml", () => xmlDeserializer);
|
||||
client.AddHandler("text/xml", () => xmlDeserializer);
|
||||
client.AddHandler("*+xml", () => xmlDeserializer);
|
||||
client.AddHandler("*", () => xmlDeserializer);
|
||||
|
||||
client.Timeout = configuration.Timeout;
|
||||
|
||||
if (configuration.Proxy != null)
|
||||
var clientOptions = new RestClientOptions(baseUrl)
|
||||
{
|
||||
client.Proxy = configuration.Proxy;
|
||||
}
|
||||
ClientCertificates = configuration.ClientCertificates,
|
||||
CookieContainer = cookies,
|
||||
MaxTimeout = configuration.Timeout,
|
||||
Proxy = configuration.Proxy,
|
||||
UserAgent = configuration.UserAgent
|
||||
};
|
||||
|
||||
if (configuration.UserAgent != null)
|
||||
{
|
||||
client.UserAgent = configuration.UserAgent;
|
||||
}
|
||||
RestClient client = new RestClient(clientOptions)
|
||||
.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration));
|
||||
|
||||
if (configuration.ClientCertificates != null)
|
||||
if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(configuration.OAuthClientSecret) &&
|
||||
configuration.OAuthFlow != null)
|
||||
{
|
||||
client.ClientCertificates = configuration.ClientCertificates;
|
||||
client = client.UseAuthenticator(new OAuthAuthenticator(
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration));
|
||||
}
|
||||
|
||||
InterceptRequest(req);
|
||||
|
||||
IRestResponse<T> response;
|
||||
RestResponse<T> response;
|
||||
if (RetryConfiguration.RetryPolicy != null)
|
||||
{
|
||||
var policy = RetryConfiguration.RetryPolicy;
|
||||
@@ -515,6 +512,10 @@ namespace Org.OpenAPITools.Client
|
||||
{
|
||||
response.Data = (T)(object)response.RawBytes;
|
||||
}
|
||||
else if (typeof(T).Name == "String") // for string response
|
||||
{
|
||||
response.Data = (T)(object)response.Content;
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
@@ -527,7 +528,7 @@ namespace Org.OpenAPITools.Client
|
||||
if (response.Cookies != null && response.Cookies.Count > 0)
|
||||
{
|
||||
if (result.Cookies == null) result.Cookies = new List<Cookie>();
|
||||
foreach (var restResponseCookie in response.Cookies)
|
||||
foreach (var restResponseCookie in response.Cookies.Cast<Cookie>())
|
||||
{
|
||||
var cookie = new Cookie(
|
||||
restResponseCookie.Name,
|
||||
@@ -556,54 +557,35 @@ namespace Org.OpenAPITools.Client
|
||||
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, RequestOptions options, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
|
||||
{
|
||||
var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl;
|
||||
RestClient client = new RestClient(baseUrl);
|
||||
|
||||
client.ClearHandlers();
|
||||
var existingDeserializer = req.JsonSerializer as IDeserializer;
|
||||
if (existingDeserializer != null)
|
||||
var clientOptions = new RestClientOptions(baseUrl)
|
||||
{
|
||||
client.AddHandler("application/json", () => existingDeserializer);
|
||||
client.AddHandler("text/json", () => existingDeserializer);
|
||||
client.AddHandler("text/x-json", () => existingDeserializer);
|
||||
client.AddHandler("text/javascript", () => existingDeserializer);
|
||||
client.AddHandler("*+json", () => existingDeserializer);
|
||||
}
|
||||
else
|
||||
ClientCertificates = configuration.ClientCertificates,
|
||||
MaxTimeout = configuration.Timeout,
|
||||
Proxy = configuration.Proxy,
|
||||
UserAgent = configuration.UserAgent
|
||||
};
|
||||
|
||||
RestClient client = new RestClient(clientOptions)
|
||||
.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration));
|
||||
|
||||
if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) &&
|
||||
!string.IsNullOrEmpty(configuration.OAuthClientId) &&
|
||||
!string.IsNullOrEmpty(configuration.OAuthClientSecret) &&
|
||||
configuration.OAuthFlow != null)
|
||||
{
|
||||
var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration);
|
||||
client.AddHandler("application/json", () => customDeserializer);
|
||||
client.AddHandler("text/json", () => customDeserializer);
|
||||
client.AddHandler("text/x-json", () => customDeserializer);
|
||||
client.AddHandler("text/javascript", () => customDeserializer);
|
||||
client.AddHandler("*+json", () => customDeserializer);
|
||||
}
|
||||
|
||||
var xmlDeserializer = new XmlDeserializer();
|
||||
client.AddHandler("application/xml", () => xmlDeserializer);
|
||||
client.AddHandler("text/xml", () => xmlDeserializer);
|
||||
client.AddHandler("*+xml", () => xmlDeserializer);
|
||||
client.AddHandler("*", () => xmlDeserializer);
|
||||
|
||||
client.Timeout = configuration.Timeout;
|
||||
|
||||
if (configuration.Proxy != null)
|
||||
{
|
||||
client.Proxy = configuration.Proxy;
|
||||
}
|
||||
|
||||
if (configuration.UserAgent != null)
|
||||
{
|
||||
client.UserAgent = configuration.UserAgent;
|
||||
}
|
||||
|
||||
if (configuration.ClientCertificates != null)
|
||||
{
|
||||
client.ClientCertificates = configuration.ClientCertificates;
|
||||
client = client.UseAuthenticator(new OAuthAuthenticator(
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration));
|
||||
}
|
||||
|
||||
InterceptRequest(req);
|
||||
|
||||
IRestResponse<T> response;
|
||||
RestResponse<T> response;
|
||||
if (RetryConfiguration.AsyncRetryPolicy != null)
|
||||
{
|
||||
var policy = RetryConfiguration.AsyncRetryPolicy;
|
||||
@@ -644,7 +626,7 @@ namespace Org.OpenAPITools.Client
|
||||
if (response.Cookies != null && response.Cookies.Count > 0)
|
||||
{
|
||||
if (result.Cookies == null) result.Cookies = new List<Cookie>();
|
||||
foreach (var restResponseCookie in response.Cookies)
|
||||
foreach (var restResponseCookie in response.Cookies.Cast<Cookie>())
|
||||
{
|
||||
var cookie = new Cookie(
|
||||
restResponseCookie.Name,
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using RestSharp.Authenticators;
|
||||
|
||||
namespace Org.OpenAPITools.Client.Auth
|
||||
{
|
||||
/// <summary>
|
||||
/// An authenticator for OAuth2 authentication flows
|
||||
/// </summary>
|
||||
public class OAuthAuthenticator : AuthenticatorBase
|
||||
{
|
||||
readonly string _tokenUrl;
|
||||
readonly string _clientId;
|
||||
readonly string _clientSecret;
|
||||
readonly string _grantType;
|
||||
readonly JsonSerializerSettings _serializerSettings;
|
||||
readonly IReadableConfiguration _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the OAuth2 Authenticator
|
||||
/// </summary>
|
||||
public OAuthAuthenticator(
|
||||
string tokenUrl,
|
||||
string clientId,
|
||||
string clientSecret,
|
||||
OAuthFlow? flow,
|
||||
JsonSerializerSettings serializerSettings,
|
||||
IReadableConfiguration configuration) : base("")
|
||||
{
|
||||
_tokenUrl = tokenUrl;
|
||||
_clientId = clientId;
|
||||
_clientSecret = clientSecret;
|
||||
_serializerSettings = serializerSettings;
|
||||
_configuration = configuration;
|
||||
|
||||
switch (flow)
|
||||
{
|
||||
/*case OAuthFlow.ACCESS_CODE:
|
||||
_grantType = "authorization_code";
|
||||
break;
|
||||
case OAuthFlow.IMPLICIT:
|
||||
_grantType = "implicit";
|
||||
break;
|
||||
case OAuthFlow.PASSWORD:
|
||||
_grantType = "password";
|
||||
break;*/
|
||||
case OAuthFlow.APPLICATION:
|
||||
_grantType = "client_credentials";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an authentication parameter from an access token.
|
||||
/// </summary>
|
||||
/// <param name="accessToken">Access token to create a parameter from.</param>
|
||||
/// <returns>An authentication parameter.</returns>
|
||||
protected override async ValueTask<Parameter> GetAuthenticationParameter(string accessToken)
|
||||
{
|
||||
var token = string.IsNullOrEmpty(Token) ? await GetToken() : Token;
|
||||
return new HeaderParameter(KnownHeaders.Authorization, token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the token from the OAuth2 server.
|
||||
/// </summary>
|
||||
/// <returns>An authentication token.</returns>
|
||||
async Task<string> GetToken()
|
||||
{
|
||||
var client = new RestClient(_tokenUrl)
|
||||
.UseSerializer(() => new CustomJsonCodec(_serializerSettings, _configuration));
|
||||
|
||||
var request = new RestRequest()
|
||||
.AddParameter("grant_type", _grantType)
|
||||
.AddParameter("client_id", _clientId)
|
||||
.AddParameter("client_secret", _clientSecret);
|
||||
var response = await client.PostAsync<TokenResponse>(request);
|
||||
return $"{response.TokenType} {response.AccessToken}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
namespace Org.OpenAPITools.Client.Auth
|
||||
{
|
||||
/// <summary>
|
||||
/// Available flows for OAuth2 authentication
|
||||
/// </summary>
|
||||
public enum OAuthFlow
|
||||
{
|
||||
/// <summary>Authorization code flow</summary>
|
||||
ACCESS_CODE,
|
||||
/// <summary>Implicit flow</summary>
|
||||
IMPLICIT,
|
||||
/// <summary>Password flow</summary>
|
||||
PASSWORD,
|
||||
/// <summary>Client credentials flow</summary>
|
||||
APPLICATION
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Org.OpenAPITools.Client.Auth
|
||||
{
|
||||
class TokenResponse
|
||||
{
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
[JsonProperty("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,16 @@ namespace Org.OpenAPITools.Client
|
||||
return Convert.ToString(obj, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the given object when not null. Otherwise return null.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to serialize.</param>
|
||||
/// <returns>Serialized string.</returns>
|
||||
public static string Serialize(object obj)
|
||||
{
|
||||
return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode string in base64 format.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,8 @@ using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Net.Http;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
|
||||
namespace Org.OpenAPITools.Client
|
||||
{
|
||||
@@ -113,7 +115,7 @@ namespace Org.OpenAPITools.Client
|
||||
public Configuration()
|
||||
{
|
||||
Proxy = null;
|
||||
UserAgent = "OpenAPI-Generator/1.0.0/csharp";
|
||||
UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp");
|
||||
BasePath = "http://petstore.swagger.io:80/v2";
|
||||
DefaultHeaders = new ConcurrentDictionary<string, string>();
|
||||
ApiKey = new ConcurrentDictionary<string, string>();
|
||||
@@ -361,6 +363,30 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The access token.</value>
|
||||
public virtual string AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the token URL for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Token URL.</value>
|
||||
public virtual string OAuthTokenUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client ID for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client ID.</value>
|
||||
public virtual string OAuthClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client secret for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Flow.</value>
|
||||
public virtual OAuthFlow? OAuthFlow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the temporary folder path to store the files downloaded from the server.
|
||||
/// </summary>
|
||||
@@ -684,6 +710,10 @@ namespace Org.OpenAPITools.Client
|
||||
Username = second.Username ?? first.Username,
|
||||
Password = second.Password ?? first.Password,
|
||||
AccessToken = second.AccessToken ?? first.AccessToken,
|
||||
OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl,
|
||||
OAuthClientId = second.OAuthClientId ?? first.OAuthClientId,
|
||||
OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret,
|
||||
OAuthFlow = second.OAuthFlow ?? first.OAuthFlow,
|
||||
HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration,
|
||||
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
|
||||
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
|
||||
|
||||
@@ -325,14 +325,18 @@ namespace Org.OpenAPITools.Client
|
||||
/// <returns>ECDSA signature</returns>
|
||||
private string GetECDSASignature(byte[] dataToSign)
|
||||
{
|
||||
if (!File.Exists(KeyFilePath))
|
||||
string keyStr = string.Empty;
|
||||
if (File.Exists(KeyFilePath))
|
||||
{
|
||||
throw new Exception("key file path does not exist.");
|
||||
keyStr = File.ReadAllText(KeyFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyStr = KeyFilePath;
|
||||
}
|
||||
|
||||
const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----";
|
||||
const string ecKeyFooter = "-----END EC PRIVATE KEY-----";
|
||||
var keyStr = File.ReadAllText(KeyFilePath);
|
||||
var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim();
|
||||
var keyBytes = System.Convert.FromBase64String(ecKeyBase64String);
|
||||
var ecdsa = ECDsa.Create();
|
||||
@@ -430,11 +434,15 @@ namespace Org.OpenAPITools.Client
|
||||
bool isPrivateKeyFile = true;
|
||||
byte[] pemkey = null;
|
||||
|
||||
if (!File.Exists(pemfile))
|
||||
string pemstr = string.Empty;
|
||||
if (File.Exists(pemfile))
|
||||
{
|
||||
throw new Exception("private key file does not exist.");
|
||||
pemstr = File.ReadAllText(pemfile).Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
pemstr = pemfile;
|
||||
}
|
||||
string pemstr = File.ReadAllText(pemfile).Trim();
|
||||
|
||||
if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter))
|
||||
{
|
||||
@@ -725,9 +733,16 @@ namespace Org.OpenAPITools.Client
|
||||
/// <returns>Private Key Type</returns>
|
||||
private PrivateKeyType GetKeyType(string keyFilePath)
|
||||
{
|
||||
if (!File.Exists(keyFilePath))
|
||||
string[] key = null;
|
||||
|
||||
if (File.Exists(keyFilePath))
|
||||
{
|
||||
throw new Exception("Key file path does not exist.");
|
||||
key = File.ReadAllLines(keyFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The ApiKeyFilePath is passed as string
|
||||
key = new string[] { keyFilePath };
|
||||
}
|
||||
|
||||
const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY";
|
||||
@@ -737,7 +752,6 @@ namespace Org.OpenAPITools.Client
|
||||
//var pkcs8Header = "BEGIN PRIVATE KEY";
|
||||
//var pkcs8Footer = "END PRIVATE KEY";
|
||||
PrivateKeyType keyType;
|
||||
var key = File.ReadAllLines(keyFilePath);
|
||||
|
||||
if (key[0].Contains(rsaPrivateKeyHeader) &&
|
||||
key[key.Length - 1].ToString().Contains(rsaPrivateFooter))
|
||||
@@ -751,7 +765,7 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Either the key is invalid or key is not supported");
|
||||
throw new Exception("The key file path does not exist or key is invalid or key is not supported");
|
||||
}
|
||||
return keyType;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Org.OpenAPITools.Client.Auth;
|
||||
|
||||
namespace Org.OpenAPITools.Client
|
||||
{
|
||||
@@ -26,6 +27,30 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>Access token.</value>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token URL.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token URL.</value>
|
||||
string OAuthTokenUrl { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth client ID.
|
||||
/// </summary>
|
||||
/// <value>OAuth Client ID.</value>
|
||||
string OAuthClientId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth client secret.
|
||||
/// </summary>
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
/// <value>OAuth Flow.</value>
|
||||
OAuthFlow? OAuthFlow { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API key.
|
||||
/// </summary>
|
||||
|
||||
@@ -68,6 +68,11 @@ namespace Org.OpenAPITools.Client
|
||||
/// </summary>
|
||||
public Object Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If request should be authenticated with OAuth.
|
||||
/// </summary>
|
||||
public bool OAuth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of <see cref="RequestOptions"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Org.OpenAPITools.Client
|
||||
/// <summary>
|
||||
/// Retry policy
|
||||
/// </summary>
|
||||
public static Policy<IRestResponse> RetryPolicy { get; set; }
|
||||
public static Policy<RestResponse> RetryPolicy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Async retry policy
|
||||
/// </summary>
|
||||
public static AsyncPolicy<IRestResponse> AsyncRetryPolicy { get; set; }
|
||||
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName
|
||||
{
|
||||
get{ return _ClassName;}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Cultivar
|
||||
/// </summary>
|
||||
[DataMember(Name = "cultivar", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "cultivar", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string Cultivar
|
||||
{
|
||||
get{ return _Cultivar;}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets LengthCm
|
||||
/// </summary>
|
||||
[DataMember(Name = "lengthCm", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "lengthCm", IsRequired = true, EmitDefaultValue = true)]
|
||||
public decimal LengthCm
|
||||
{
|
||||
get{ return _LengthCm;}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName
|
||||
{
|
||||
get{ return _ClassName;}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||
{
|
||||
foreach (var x in BaseValidate(validationContext))
|
||||
foreach (var x in base.BaseValidate(validationContext))
|
||||
{
|
||||
yield return x;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string Name
|
||||
{
|
||||
get{ return _Name;}
|
||||
|
||||
@@ -77,14 +77,6 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||
/// </summary>
|
||||
[JsonConstructorAttribute]
|
||||
protected ChildCat()
|
||||
{
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChildCat" /> class.
|
||||
/// </summary>
|
||||
/// <param name="name">name.</param>
|
||||
/// <param name="petType">petType (default to PetTypeEnum.ChildCat).</param>
|
||||
public ChildCat(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat) : base()
|
||||
@@ -211,7 +203,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||
{
|
||||
foreach (var x in BaseValidate(validationContext))
|
||||
foreach (var x in base.BaseValidate(validationContext))
|
||||
{
|
||||
yield return x;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
@@ -89,7 +89,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string QuadrilateralType
|
||||
{
|
||||
get{ return _QuadrilateralType;}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName
|
||||
{
|
||||
get{ return _ClassName;}
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||
{
|
||||
foreach (var x in BaseValidate(validationContext))
|
||||
foreach (var x in base.BaseValidate(validationContext))
|
||||
{
|
||||
yield return x;
|
||||
}
|
||||
|
||||
@@ -98,33 +98,6 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
|
||||
[DataMember(Name = "array_enum", EmitDefaultValue = false)]
|
||||
public List<ArrayEnumEnum> ArrayEnum
|
||||
{
|
||||
get{ return _ArrayEnum;}
|
||||
set
|
||||
{
|
||||
_ArrayEnum = value;
|
||||
_flagArrayEnum = true;
|
||||
}
|
||||
}
|
||||
private List<ArrayEnumEnum> _ArrayEnum;
|
||||
private bool _flagArrayEnum;
|
||||
|
||||
/// <summary>
|
||||
/// Returns false as ArrayEnum should not be serialized given that it's read-only.
|
||||
/// </summary>
|
||||
/// <returns>false (boolean)</returns>
|
||||
public bool ShouldSerializeArrayEnum()
|
||||
{
|
||||
return _flagArrayEnum;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EnumArrays" /> class.
|
||||
/// </summary>
|
||||
@@ -145,6 +118,30 @@ namespace Org.OpenAPITools.Model
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[DataMember(Name = "array_enum", EmitDefaultValue = false)]
|
||||
public List<EnumArrays.ArrayEnumEnum> ArrayEnum
|
||||
{
|
||||
get{ return _ArrayEnum;}
|
||||
set
|
||||
{
|
||||
_ArrayEnum = value;
|
||||
_flagArrayEnum = true;
|
||||
}
|
||||
}
|
||||
private List<EnumArrays.ArrayEnumEnum> _ArrayEnum;
|
||||
private bool _flagArrayEnum;
|
||||
|
||||
/// <summary>
|
||||
/// Returns false as ArrayEnum should not be serialized given that it's read-only.
|
||||
/// </summary>
|
||||
/// <returns>false (boolean)</returns>
|
||||
public bool ShouldSerializeArrayEnum()
|
||||
{
|
||||
return _flagArrayEnum;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
@@ -205,7 +202,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
int hashCode = 41;
|
||||
hashCode = (hashCode * 59) + this.JustSymbol.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
if (this.ArrayEnum != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// Gets or Sets EnumStringRequired
|
||||
/// </summary>
|
||||
|
||||
[DataMember(Name = "enum_string_required", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "enum_string_required", IsRequired = true, EmitDefaultValue = true)]
|
||||
public EnumStringRequiredEnum EnumStringRequired
|
||||
{
|
||||
get{ return _EnumStringRequired;}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
@@ -89,7 +89,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets TriangleType
|
||||
/// </summary>
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string TriangleType
|
||||
{
|
||||
get{ return _TriangleType;}
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Number
|
||||
/// </summary>
|
||||
[DataMember(Name = "number", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "number", IsRequired = true, EmitDefaultValue = true)]
|
||||
public decimal Number
|
||||
{
|
||||
get{ return _Number;}
|
||||
@@ -333,7 +333,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Byte
|
||||
/// </summary>
|
||||
[DataMember(Name = "byte", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "byte", IsRequired = true, EmitDefaultValue = true)]
|
||||
public byte[] Byte
|
||||
{
|
||||
get{ return _Byte;}
|
||||
@@ -382,7 +382,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// Gets or Sets Date
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(OpenAPIDateConverter))]
|
||||
[DataMember(Name = "date", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)]
|
||||
public DateTime Date
|
||||
{
|
||||
get{ return _Date;}
|
||||
@@ -454,7 +454,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Password
|
||||
/// </summary>
|
||||
[DataMember(Name = "password", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "password", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string Password
|
||||
{
|
||||
get{ return _Password;}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets PetType
|
||||
/// </summary>
|
||||
[DataMember(Name = "pet_type", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "pet_type", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string PetType
|
||||
{
|
||||
get{ return _PetType;}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
@@ -85,7 +85,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets TriangleType
|
||||
/// </summary>
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string TriangleType
|
||||
{
|
||||
get{ return _TriangleType;}
|
||||
|
||||
@@ -52,33 +52,6 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
|
||||
[DataMember(Name = "map_of_enum_string", EmitDefaultValue = false)]
|
||||
public Dictionary<string, InnerEnum> MapOfEnumString
|
||||
{
|
||||
get{ return _MapOfEnumString;}
|
||||
set
|
||||
{
|
||||
_MapOfEnumString = value;
|
||||
_flagMapOfEnumString = true;
|
||||
}
|
||||
}
|
||||
private Dictionary<string, InnerEnum> _MapOfEnumString;
|
||||
private bool _flagMapOfEnumString;
|
||||
|
||||
/// <summary>
|
||||
/// Returns false as MapOfEnumString should not be serialized given that it's read-only.
|
||||
/// </summary>
|
||||
/// <returns>false (boolean)</returns>
|
||||
public bool ShouldSerializeMapOfEnumString()
|
||||
{
|
||||
return _flagMapOfEnumString;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MapTest" /> class.
|
||||
/// </summary>
|
||||
@@ -136,6 +109,30 @@ namespace Org.OpenAPITools.Model
|
||||
return _flagMapMapOfString;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[DataMember(Name = "map_of_enum_string", EmitDefaultValue = false)]
|
||||
public Dictionary<string, MapTest.InnerEnum> MapOfEnumString
|
||||
{
|
||||
get{ return _MapOfEnumString;}
|
||||
set
|
||||
{
|
||||
_MapOfEnumString = value;
|
||||
_flagMapOfEnumString = true;
|
||||
}
|
||||
}
|
||||
private Dictionary<string, MapTest.InnerEnum> _MapOfEnumString;
|
||||
private bool _flagMapOfEnumString;
|
||||
|
||||
/// <summary>
|
||||
/// Returns false as MapOfEnumString should not be serialized given that it's read-only.
|
||||
/// </summary>
|
||||
/// <returns>false (boolean)</returns>
|
||||
public bool ShouldSerializeMapOfEnumString()
|
||||
{
|
||||
return _flagMapOfEnumString;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets DirectMap
|
||||
/// </summary>
|
||||
[DataMember(Name = "direct_map", EmitDefaultValue = false)]
|
||||
@@ -248,7 +245,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapMapOfString.GetHashCode();
|
||||
}
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
if (this.MapOfEnumString != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
}
|
||||
if (this.DirectMap != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.DirectMap.GetHashCode();
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets _Name
|
||||
/// </summary>
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
|
||||
public int _Name
|
||||
{
|
||||
get{ return __Name;}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||
{
|
||||
foreach (var x in BaseValidate(validationContext))
|
||||
foreach (var x in base.BaseValidate(validationContext))
|
||||
{
|
||||
yield return x;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string Name
|
||||
{
|
||||
get{ return _Name;}
|
||||
@@ -215,7 +215,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// </summary>
|
||||
[DataMember(Name = "photoUrls", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "photoUrls", IsRequired = true, EmitDefaultValue = true)]
|
||||
public List<string> PhotoUrls
|
||||
{
|
||||
get{ return _PhotoUrls;}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string QuadrilateralType
|
||||
{
|
||||
get{ return _QuadrilateralType;}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
@@ -89,7 +89,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets TriangleType
|
||||
/// </summary>
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string TriangleType
|
||||
{
|
||||
get{ return _TriangleType;}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ShapeType
|
||||
/// </summary>
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "shapeType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ShapeType
|
||||
{
|
||||
get{ return _ShapeType;}
|
||||
@@ -89,7 +89,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets QuadrilateralType
|
||||
/// </summary>
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string QuadrilateralType
|
||||
{
|
||||
get{ return _QuadrilateralType;}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets TriangleType
|
||||
/// </summary>
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string TriangleType
|
||||
{
|
||||
get{ return _TriangleType;}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName
|
||||
{
|
||||
get{ return _ClassName;}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName
|
||||
{
|
||||
get{ return _ClassName;}
|
||||
|
||||
@@ -21,11 +21,17 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CompareNETObjects" Version="4.61.0" />
|
||||
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
|
||||
<PackageReference Include="JsonSubTypes" Version="1.9.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
||||
<PackageReference Include="RestSharp" Version="108.0.2" />
|
||||
<PackageReference Include="Polly" Version="7.2.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<string>** | | [optional]
|
||||
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [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)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# Org.OpenAPITools.Model.InlineResponseDefault
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**String** | [**Foo**](Foo.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)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, string>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional]
|
||||
**DirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
**IndirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public async Task FooGetAsyncTest()
|
||||
{
|
||||
var response = await _instance.FooGetAsync();
|
||||
Assert.IsType<InlineResponseDefault>(response);
|
||||
Assert.IsType<FooGetDefaultResponse>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<Animal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Cat from type Animal
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a Cat from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'ClassName'
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<GrandparentAnimal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ChildCat from type ParentPet
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a ChildCat from type ParentPet
|
||||
//Assert.IsType<ParentPet>(JsonConvert.DeserializeObject<ParentPet>(new ChildCat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'PetType'
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// </summary>
|
||||
/// <param name="justSymbol">justSymbol</param>
|
||||
/// <param name="arrayEnum">arrayEnum</param>
|
||||
public EnumArrays(JustSymbolEnum? justSymbol = default, List<ArrayEnumEnum>? arrayEnum = default)
|
||||
public EnumArrays(JustSymbolEnum? justSymbol = default, List<EnumArrays.ArrayEnumEnum>? arrayEnum = default)
|
||||
{
|
||||
JustSymbol = justSymbol;
|
||||
ArrayEnum = arrayEnum;
|
||||
@@ -86,12 +86,11 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[JsonPropertyName("array_enum")]
|
||||
public List<ArrayEnumEnum>? ArrayEnum { get; set; }
|
||||
public List<EnumArrays.ArrayEnumEnum>? ArrayEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@@ -144,7 +143,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
int hashCode = 41;
|
||||
hashCode = (hashCode * 59) + this.JustSymbol.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
if (this.ArrayEnum != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// InlineResponseDefault
|
||||
/// </summary>
|
||||
public partial class InlineResponseDefault : IEquatable<InlineResponseDefault>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InlineResponseDefault" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string">_string</param>
|
||||
public InlineResponseDefault(Foo? _string = default)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
[JsonPropertyName("string")]
|
||||
public Foo? String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class InlineResponseDefault {\n");
|
||||
sb.Append(" String: ").Append(String).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <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 OpenAPIClientUtils.compareLogic.Compare(this, input as InlineResponseDefault).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if InlineResponseDefault instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of InlineResponseDefault to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(InlineResponseDefault? input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <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.String != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.String.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <param name="mapOfEnumString">mapOfEnumString</param>
|
||||
/// <param name="directMap">directMap</param>
|
||||
/// <param name="indirectMap">indirectMap</param>
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>>? mapMapOfString = default, Dictionary<string, InnerEnum>? mapOfEnumString = default, Dictionary<string, bool>? directMap = default, Dictionary<string, bool>? indirectMap = default)
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>>? mapMapOfString = default, Dictionary<string, MapTest.InnerEnum>? mapOfEnumString = default, Dictionary<string, bool>? directMap = default, Dictionary<string, bool>? indirectMap = default)
|
||||
{
|
||||
MapMapOfString = mapMapOfString;
|
||||
MapOfEnumString = mapOfEnumString;
|
||||
@@ -65,19 +65,18 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, InnerEnum>? MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapMapOfString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_map_of_string")]
|
||||
public Dictionary<string, Dictionary<string, string>>? MapMapOfString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, MapTest.InnerEnum>? MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets DirectMap
|
||||
/// </summary>
|
||||
@@ -146,7 +145,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapMapOfString.GetHashCode();
|
||||
}
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
if (this.MapOfEnumString != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
}
|
||||
if (this.DirectMap != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.DirectMap.GetHashCode();
|
||||
|
||||
@@ -29,4 +29,10 @@
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<string>** | | [optional]
|
||||
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [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)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# Org.OpenAPITools.Model.InlineResponseDefault
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**String** | [**Foo**](Foo.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)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, string>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional]
|
||||
**DirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
**IndirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public async Task FooGetAsyncTest()
|
||||
{
|
||||
var response = await _instance.FooGetAsync();
|
||||
Assert.IsType<InlineResponseDefault>(response);
|
||||
Assert.IsType<FooGetDefaultResponse>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<Animal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Cat from type Animal
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a Cat from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'ClassName'
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<GrandparentAnimal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ChildCat from type ParentPet
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a ChildCat from type ParentPet
|
||||
//Assert.IsType<ParentPet>(JsonConvert.DeserializeObject<ParentPet>(new ChildCat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'PetType'
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// </summary>
|
||||
/// <param name="justSymbol">justSymbol</param>
|
||||
/// <param name="arrayEnum">arrayEnum</param>
|
||||
public EnumArrays(JustSymbolEnum justSymbol = default, List<ArrayEnumEnum> arrayEnum = default)
|
||||
public EnumArrays(JustSymbolEnum justSymbol = default, List<EnumArrays.ArrayEnumEnum> arrayEnum = default)
|
||||
{
|
||||
JustSymbol = justSymbol;
|
||||
ArrayEnum = arrayEnum;
|
||||
@@ -84,12 +84,11 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[JsonPropertyName("array_enum")]
|
||||
public List<ArrayEnumEnum> ArrayEnum { get; set; }
|
||||
public List<EnumArrays.ArrayEnumEnum> ArrayEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@@ -142,7 +141,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
int hashCode = 41;
|
||||
hashCode = (hashCode * 59) + this.JustSymbol.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
if (this.ArrayEnum != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// InlineResponseDefault
|
||||
/// </summary>
|
||||
public partial class InlineResponseDefault : IEquatable<InlineResponseDefault>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InlineResponseDefault" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string">_string</param>
|
||||
public InlineResponseDefault(Foo _string = default)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
[JsonPropertyName("string")]
|
||||
public Foo String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class InlineResponseDefault {\n");
|
||||
sb.Append(" String: ").Append(String).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <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 OpenAPIClientUtils.compareLogic.Compare(this, input as InlineResponseDefault).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if InlineResponseDefault instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of InlineResponseDefault to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(InlineResponseDefault input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <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.String != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.String.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <param name="mapOfEnumString">mapOfEnumString</param>
|
||||
/// <param name="directMap">directMap</param>
|
||||
/// <param name="indirectMap">indirectMap</param>
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default, Dictionary<string, InnerEnum> mapOfEnumString = default, Dictionary<string, bool> directMap = default, Dictionary<string, bool> indirectMap = default)
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default, Dictionary<string, MapTest.InnerEnum> mapOfEnumString = default, Dictionary<string, bool> directMap = default, Dictionary<string, bool> indirectMap = default)
|
||||
{
|
||||
MapMapOfString = mapMapOfString;
|
||||
MapOfEnumString = mapOfEnumString;
|
||||
@@ -63,19 +63,18 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, InnerEnum> MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapMapOfString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_map_of_string")]
|
||||
public Dictionary<string, Dictionary<string, string>> MapMapOfString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, MapTest.InnerEnum> MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets DirectMap
|
||||
/// </summary>
|
||||
@@ -144,7 +143,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapMapOfString.GetHashCode();
|
||||
}
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
if (this.MapOfEnumString != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
}
|
||||
if (this.DirectMap != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.DirectMap.GetHashCode();
|
||||
|
||||
@@ -28,4 +28,10 @@
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<string>** | | [optional]
|
||||
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [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)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# Org.OpenAPITools.Model.InlineResponseDefault
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**String** | [**Foo**](Foo.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)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, string>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional]
|
||||
**DirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
**IndirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public async Task FooGetAsyncTest()
|
||||
{
|
||||
var response = await _instance.FooGetAsync();
|
||||
Assert.IsType<InlineResponseDefault>(response);
|
||||
Assert.IsType<FooGetDefaultResponse>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<Animal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Cat from type Animal
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a Cat from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'ClassName'
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<GrandparentAnimal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ChildCat from type ParentPet
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a ChildCat from type ParentPet
|
||||
//Assert.IsType<ParentPet>(JsonConvert.DeserializeObject<ParentPet>(new ChildCat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'PetType'
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// </summary>
|
||||
/// <param name="justSymbol">justSymbol</param>
|
||||
/// <param name="arrayEnum">arrayEnum</param>
|
||||
public EnumArrays(JustSymbolEnum justSymbol = default, List<ArrayEnumEnum> arrayEnum = default)
|
||||
public EnumArrays(JustSymbolEnum justSymbol = default, List<EnumArrays.ArrayEnumEnum> arrayEnum = default)
|
||||
{
|
||||
JustSymbol = justSymbol;
|
||||
ArrayEnum = arrayEnum;
|
||||
@@ -84,12 +84,11 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ArrayEnum
|
||||
/// </summary>
|
||||
[JsonPropertyName("array_enum")]
|
||||
public List<ArrayEnumEnum> ArrayEnum { get; set; }
|
||||
public List<EnumArrays.ArrayEnumEnum> ArrayEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@@ -142,7 +141,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
int hashCode = 41;
|
||||
hashCode = (hashCode * 59) + this.JustSymbol.GetHashCode();
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
if (this.ArrayEnum != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
// <auto-generated>
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
|
||||
|
||||
namespace Org.OpenAPITools.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// InlineResponseDefault
|
||||
/// </summary>
|
||||
public partial class InlineResponseDefault : IEquatable<InlineResponseDefault>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InlineResponseDefault" /> class.
|
||||
/// </summary>
|
||||
/// <param name="_string">_string</param>
|
||||
public InlineResponseDefault(Foo _string = default)
|
||||
{
|
||||
String = _string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets String
|
||||
/// </summary>
|
||||
[JsonPropertyName("string")]
|
||||
public Foo String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; set; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("class InlineResponseDefault {\n");
|
||||
sb.Append(" String: ").Append(String).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <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 OpenAPIClientUtils.compareLogic.Compare(this, input as InlineResponseDefault).AreEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if InlineResponseDefault instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of InlineResponseDefault to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(InlineResponseDefault input)
|
||||
{
|
||||
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
|
||||
}
|
||||
|
||||
/// <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.String != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.String.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <param name="mapOfEnumString">mapOfEnumString</param>
|
||||
/// <param name="directMap">directMap</param>
|
||||
/// <param name="indirectMap">indirectMap</param>
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default, Dictionary<string, InnerEnum> mapOfEnumString = default, Dictionary<string, bool> directMap = default, Dictionary<string, bool> indirectMap = default)
|
||||
public MapTest(Dictionary<string, Dictionary<string, string>> mapMapOfString = default, Dictionary<string, MapTest.InnerEnum> mapOfEnumString = default, Dictionary<string, bool> directMap = default, Dictionary<string, bool> indirectMap = default)
|
||||
{
|
||||
MapMapOfString = mapMapOfString;
|
||||
MapOfEnumString = mapOfEnumString;
|
||||
@@ -63,19 +63,18 @@ namespace Org.OpenAPITools.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, InnerEnum> MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapMapOfString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_map_of_string")]
|
||||
public Dictionary<string, Dictionary<string, string>> MapMapOfString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets MapOfEnumString
|
||||
/// </summary>
|
||||
[JsonPropertyName("map_of_enum_string")]
|
||||
public Dictionary<string, MapTest.InnerEnum> MapOfEnumString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets DirectMap
|
||||
/// </summary>
|
||||
@@ -144,7 +143,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapMapOfString.GetHashCode();
|
||||
}
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
if (this.MapOfEnumString != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.MapOfEnumString.GetHashCode();
|
||||
}
|
||||
if (this.DirectMap != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.DirectMap.GetHashCode();
|
||||
|
||||
@@ -28,4 +28,10 @@
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**JustSymbol** | **string** | | [optional]
|
||||
**ArrayEnum** | **List<string>** | | [optional]
|
||||
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [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)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, string>** | | [optional]
|
||||
**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional]
|
||||
**DirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
**IndirectMap** | **Dictionary<string, bool>** | | [optional]
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
// TODO uncomment below to test the method and replace null with proper value
|
||||
//var response = instance.FooGet();
|
||||
//Assert.IsType<InlineResponseDefault>(response);
|
||||
//Assert.IsType<FooGetDefaultResponse>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
//long? int64 = null;
|
||||
//float? _float = null;
|
||||
//string _string = null;
|
||||
//System.IO.Stream binary = null;
|
||||
//FileParameter binary = null;
|
||||
//DateTime? date = null;
|
||||
//DateTime? dateTime = null;
|
||||
//string password = null;
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<Animal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Cat from type Animal
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a Cat from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a Dog from type Animal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DogDeserializeFromAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a Dog from type Animal
|
||||
//Assert.IsType<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'ClassName'
|
||||
|
||||
@@ -81,6 +81,14 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO unit test for the property 'EnumInteger'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property 'EnumIntegerOnly'
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EnumIntegerOnlyTest()
|
||||
{
|
||||
// TODO unit test for the property 'EnumIntegerOnly'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property 'EnumNumber'
|
||||
/// </summary>
|
||||
[Fact]
|
||||
|
||||
@@ -55,15 +55,6 @@ namespace Org.OpenAPITools.Test.Model
|
||||
//Assert.IsType<GrandparentAnimal>(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ChildCat from type ParentPet
|
||||
/// </summary>
|
||||
@@ -73,6 +64,15 @@ namespace Org.OpenAPITools.Test.Model
|
||||
// TODO uncomment below to test deserialize a ChildCat from type ParentPet
|
||||
//Assert.IsType<ParentPet>(JsonConvert.DeserializeObject<ParentPet>(new ChildCat().ToJson()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Test deserialize a ParentPet from type GrandparentAnimal
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ParentPetDeserializeFromGrandparentAnimalTest()
|
||||
{
|
||||
// TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal
|
||||
//Assert.IsType<GrandparentAnimal>(JsonConvert.DeserializeObject<GrandparentAnimal>(new ParentPet().ToJson()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'PetType'
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://github.com/openapitools/openapi-generator.git
|
||||
*/
|
||||
|
||||
|
||||
using Xunit;
|
||||
|
||||
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.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing InlineResponseDefault
|
||||
/// </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>
|
||||
public class InlineResponseDefaultTests : IDisposable
|
||||
{
|
||||
// TODO uncomment below to declare an instance variable for InlineResponseDefault
|
||||
//private InlineResponseDefault instance;
|
||||
|
||||
public InlineResponseDefaultTests()
|
||||
{
|
||||
// TODO uncomment below to create an instance of InlineResponseDefault
|
||||
//instance = new InlineResponseDefault();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Cleanup when everything is done.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of InlineResponseDefault
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InlineResponseDefaultInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsType" InlineResponseDefault
|
||||
//Assert.IsType<InlineResponseDefault>(instance);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'String'
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void StringTest()
|
||||
{
|
||||
// TODO unit test for the property 'String'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,12 +57,12 @@ namespace Org.OpenAPITools.Test.Model
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test the property '__Client'
|
||||
/// Test the property '_Client'
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void __ClientTest()
|
||||
public void _ClientTest()
|
||||
{
|
||||
// TODO unit test for the property '__Client'
|
||||
// TODO unit test for the property '_Client'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,14 @@ namespace Org.OpenAPITools.Test.Model
|
||||
{
|
||||
// TODO unit test for the property 'SpecialPropertyName'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property '_SpecialModelName'
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void _SpecialModelNameTest()
|
||||
{
|
||||
// TODO unit test for the property '_SpecialModelName'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -451,80 +451,97 @@ namespace Org.OpenAPITools.Client
|
||||
IReadableConfiguration configuration,
|
||||
System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
|
||||
{
|
||||
CancellationTokenSource timeoutTokenSource = null;
|
||||
CancellationTokenSource finalTokenSource = null;
|
||||
var deserializer = new CustomJsonCodec(SerializerSettings, configuration);
|
||||
|
||||
var finalToken = cancellationToken;
|
||||
|
||||
if (configuration.Timeout > 0)
|
||||
try
|
||||
{
|
||||
var tokenSource = new CancellationTokenSource(configuration.Timeout);
|
||||
finalToken = CancellationTokenSource.CreateLinkedTokenSource(finalToken, tokenSource.Token).Token;
|
||||
}
|
||||
|
||||
if (configuration.Proxy != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
_httpClientHandler.Proxy = configuration.Proxy;
|
||||
}
|
||||
|
||||
if (configuration.ClientCertificates != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
_httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
|
||||
}
|
||||
|
||||
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List<Cookie> : null;
|
||||
|
||||
if (cookieContainer != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
foreach (var cookie in cookieContainer)
|
||||
if (configuration.Timeout > 0)
|
||||
{
|
||||
_httpClientHandler.CookieContainer.Add(cookie);
|
||||
timeoutTokenSource = new CancellationTokenSource(configuration.Timeout);
|
||||
finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token);
|
||||
finalToken = finalTokenSource.Token;
|
||||
}
|
||||
|
||||
if (configuration.Proxy != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
_httpClientHandler.Proxy = configuration.Proxy;
|
||||
}
|
||||
|
||||
if (configuration.ClientCertificates != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Configuration `ClientCertificates` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
_httpClientHandler.ClientCertificates.AddRange(configuration.ClientCertificates);
|
||||
}
|
||||
|
||||
var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List<Cookie> : null;
|
||||
|
||||
if (cookieContainer != null)
|
||||
{
|
||||
if(_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor.");
|
||||
foreach (var cookie in cookieContainer)
|
||||
{
|
||||
_httpClientHandler.CookieContainer.Add(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
InterceptRequest(req);
|
||||
|
||||
HttpResponseMessage response;
|
||||
if (RetryConfiguration.AsyncRetryPolicy != null)
|
||||
{
|
||||
var policy = RetryConfiguration.AsyncRetryPolicy;
|
||||
var policyResult = await policy
|
||||
.ExecuteAndCaptureAsync(() => _httpClient.SendAsync(req, finalToken))
|
||||
.ConfigureAwait(false);
|
||||
response = (policyResult.Outcome == OutcomeType.Successful) ?
|
||||
policyResult.Result : new HttpResponseMessage()
|
||||
{
|
||||
ReasonPhrase = policyResult.FinalException.ToString(),
|
||||
RequestMessage = req
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return await ToApiResponse<T>(response, default(T), req.RequestUri);
|
||||
}
|
||||
|
||||
object responseData = await deserializer.Deserialize<T>(response);
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
responseData = (T) (object) await response.Content.ReadAsStreamAsync();
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
return await ToApiResponse<T>(response, responseData, req.RequestUri);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (timeoutTokenSource != null)
|
||||
{
|
||||
timeoutTokenSource.Dispose();
|
||||
}
|
||||
|
||||
if (finalTokenSource != null)
|
||||
{
|
||||
finalTokenSource.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
InterceptRequest(req);
|
||||
|
||||
HttpResponseMessage response;
|
||||
if (RetryConfiguration.AsyncRetryPolicy != null)
|
||||
{
|
||||
var policy = RetryConfiguration.AsyncRetryPolicy;
|
||||
var policyResult = await policy
|
||||
.ExecuteAndCaptureAsync(() => _httpClient.SendAsync(req, cancellationToken))
|
||||
.ConfigureAwait(false);
|
||||
response = (policyResult.Outcome == OutcomeType.Successful) ?
|
||||
policyResult.Result : new HttpResponseMessage()
|
||||
{
|
||||
ReasonPhrase = policyResult.FinalException.ToString(),
|
||||
RequestMessage = req
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
response = await _httpClient.SendAsync(req, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return await ToApiResponse<T>(response, default(T), req.RequestUri);
|
||||
}
|
||||
|
||||
object responseData = await deserializer.Deserialize<T>(response);
|
||||
|
||||
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
|
||||
if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
|
||||
}
|
||||
else if (typeof(T).Name == "Stream") // for binary response
|
||||
{
|
||||
responseData = (T) (object) await response.Content.ReadAsStreamAsync();
|
||||
}
|
||||
|
||||
InterceptResponse(req, response);
|
||||
|
||||
return await ToApiResponse<T>(response, responseData, req.RequestUri);
|
||||
}
|
||||
|
||||
#region IAsynchronousClient
|
||||
|
||||
@@ -120,6 +120,16 @@ namespace Org.OpenAPITools.Client
|
||||
return Convert.ToString(obj, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the given object when not null. Otherwise return null.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to serialize.</param>
|
||||
/// <returns>Serialized string.</returns>
|
||||
public static string Serialize(object obj)
|
||||
{
|
||||
return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode string in base64 format.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Org.OpenAPITools.Client
|
||||
{
|
||||
@@ -113,7 +114,7 @@ namespace Org.OpenAPITools.Client
|
||||
public Configuration()
|
||||
{
|
||||
Proxy = null;
|
||||
UserAgent = "OpenAPI-Generator/1.0.0/csharp";
|
||||
UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp");
|
||||
BasePath = "http://petstore.swagger.io:80/v2";
|
||||
DefaultHeaders = new ConcurrentDictionary<string, string>();
|
||||
ApiKey = new ConcurrentDictionary<string, string>();
|
||||
|
||||
@@ -325,14 +325,18 @@ namespace Org.OpenAPITools.Client
|
||||
/// <returns>ECDSA signature</returns>
|
||||
private string GetECDSASignature(byte[] dataToSign)
|
||||
{
|
||||
if (!File.Exists(KeyFilePath))
|
||||
string keyStr = string.Empty;
|
||||
if (File.Exists(KeyFilePath))
|
||||
{
|
||||
throw new Exception("key file path does not exist.");
|
||||
keyStr = File.ReadAllText(KeyFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyStr = KeyFilePath;
|
||||
}
|
||||
|
||||
const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----";
|
||||
const string ecKeyFooter = "-----END EC PRIVATE KEY-----";
|
||||
var keyStr = File.ReadAllText(KeyFilePath);
|
||||
var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim();
|
||||
var keyBytes = System.Convert.FromBase64String(ecKeyBase64String);
|
||||
var ecdsa = ECDsa.Create();
|
||||
@@ -430,11 +434,15 @@ namespace Org.OpenAPITools.Client
|
||||
bool isPrivateKeyFile = true;
|
||||
byte[] pemkey = null;
|
||||
|
||||
if (!File.Exists(pemfile))
|
||||
string pemstr = string.Empty;
|
||||
if (File.Exists(pemfile))
|
||||
{
|
||||
throw new Exception("private key file does not exist.");
|
||||
pemstr = File.ReadAllText(pemfile).Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
pemstr = pemfile;
|
||||
}
|
||||
string pemstr = File.ReadAllText(pemfile).Trim();
|
||||
|
||||
if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter))
|
||||
{
|
||||
@@ -725,9 +733,16 @@ namespace Org.OpenAPITools.Client
|
||||
/// <returns>Private Key Type</returns>
|
||||
private PrivateKeyType GetKeyType(string keyFilePath)
|
||||
{
|
||||
if (!File.Exists(keyFilePath))
|
||||
string[] key = null;
|
||||
|
||||
if (File.Exists(keyFilePath))
|
||||
{
|
||||
throw new Exception("Key file path does not exist.");
|
||||
key = File.ReadAllLines(keyFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The ApiKeyFilePath is passed as string
|
||||
key = new string[] { keyFilePath };
|
||||
}
|
||||
|
||||
const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY";
|
||||
@@ -737,7 +752,6 @@ namespace Org.OpenAPITools.Client
|
||||
//var pkcs8Header = "BEGIN PRIVATE KEY";
|
||||
//var pkcs8Footer = "END PRIVATE KEY";
|
||||
PrivateKeyType keyType;
|
||||
var key = File.ReadAllLines(keyFilePath);
|
||||
|
||||
if (key[0].Contains(rsaPrivateKeyHeader) &&
|
||||
key[key.Length - 1].ToString().Contains(rsaPrivateFooter))
|
||||
@@ -751,7 +765,7 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Either the key is invalid or key is not supported");
|
||||
throw new Exception("The key file path does not exist or key is invalid or key is not supported");
|
||||
}
|
||||
return keyType;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets Cultivar
|
||||
/// </summary>
|
||||
[DataMember(Name = "cultivar", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "cultivar", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string Cultivar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets LengthCm
|
||||
/// </summary>
|
||||
[DataMember(Name = "lengthCm", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "lengthCm", IsRequired = true, EmitDefaultValue = true)]
|
||||
public decimal LengthCm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = false)]
|
||||
[DataMember(Name = "className", IsRequired = true, EmitDefaultValue = true)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user