[C#] fix anyof, oneof mixed primitive object parse error (#17986)

* Update csharp oneOf and anyOf mustache templates to accept primitive, object, and array types when deserializing

 Add bug openapi spec

Remove generated files

Add test endpoints

Generate base on spec

Remove issue spec as it is moved into sample test spec

Add back in number and int

Round trip anyOf/oneOf serialization tests

Generate classes with int/num types

Do through converter instead of object ctor

Regen models

Use convert methods

Regen models

Test data

Add enum

Remove enums

Regenned models

* update sha256

* use new spec

* skip tests

* update workflow

* fix

---------

Co-authored-by: Ruben Aguilar <ruben.aguilar@forgeglobal.com>
This commit is contained in:
William Cheng
2024-02-29 16:05:08 +08:00
committed by GitHub
parent c10c9146b9
commit d4e10508cd
293 changed files with 19281 additions and 520 deletions

View File

@@ -42,6 +42,8 @@ jobs:
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln
- name: Test
working-directory: ${{ matrix.sample }}
run: dotnet test Org.OpenAPITools.sln
# skip tests as petstore server it not running
# these tests are run in appveyor instead
#- name: Test
# working-directory: ${{ matrix.sample }}
# run: dotnet test Org.OpenAPITools.sln

View File

@@ -25,7 +25,7 @@ jobs:
- samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-useSourceGeneration
- samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration
- samples/client/petstore/csharp/OpenAPIClient-generichost-net7.0-useDateTimeForDate
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf
- samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf

View File

@@ -1,7 +1,7 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net47
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,7 +1,7 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net48
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,7 +1,7 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient-net5.0
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,7 +1,7 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,7 +1,7 @@
---
# csharp test files and image for upload
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: 054adb6efaff70f492e471cb3e4d628d22cda814906808fd3fcce36ce710b7ee
sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: 7dad88554fe630d25c787cae05305d302d5e34ca810aee4fa23f20055f9188e1
- filename: "samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"

View File

@@ -208,11 +208,37 @@
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
{{#anyOf}}
{{#isInteger}}
case JsonToken.Integer:
return new {{classname}}(Convert.ToInt32(reader.Value));
{{/isInteger}}
{{#isNumber}}
case JsonToken.Float:
return new {{classname}}(Convert.ToDecimal(reader.Value));
{{/isNumber}}
{{#isString}}
case JsonToken.String:
return new {{classname}}(Convert.ToString(reader.Value));
{{/isString}}
{{#isBoolean}}
case JsonToken.Boolean:
return new {{classname}}(Convert.ToBoolean(reader.Value));
{{/isBoolean}}
{{#isDate}}
case JsonToken.Date:
return new {{classname}}(Convert.ToDateTime(reader.Value));
{{/isDate}}
{{/anyOf}}
case JsonToken.StartObject:
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return {{classname}}.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -245,11 +245,37 @@
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
{{#oneOf}}
{{#isInteger}}
case JsonToken.Integer:
return new {{classname}}(Convert.ToInt32(reader.Value));
{{/isInteger}}
{{#isNumber}}
case JsonToken.Float:
return new {{classname}}(Convert.ToDecimal(reader.Value));
{{/isNumber}}
{{#isString}}
case JsonToken.String:
return new {{classname}}(Convert.ToString(reader.Value));
{{/isString}}
{{#isBoolean}}
case JsonToken.Boolean:
return new {{classname}}(Convert.ToBoolean(reader.Value));
{{/isBoolean}}
{{#isDate}}
case JsonToken.Date:
return new {{classname}}(Convert.ToDateTime(reader.Value));
{{/isDate}}
{{/oneOf}}
case JsonToken.StartObject:
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return {{classname}}.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -227,11 +227,39 @@
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
{{#composedSchemas.anyOf}}
{{^vendorExtensions.x-duplicated-data-type}}
{{#isInteger}}
case JsonToken.Integer:
return new {{classname}}(Convert.ToInt32(reader.Value));
{{/isInteger}}
{{#isNumber}}
case JsonToken.Float:
return new {{classname}}(Convert.ToDecimal(reader.Value));
{{/isNumber}}
{{#isString}}
case JsonToken.String:
return new {{classname}}(Convert.ToString(reader.Value));
{{/isString}}
{{#isBoolean}}
case JsonToken.Boolean:
return new {{classname}}(Convert.ToBoolean(reader.Value));
{{/isBoolean}}
{{#isDate}}
case JsonToken.Date:
return new {{classname}}(Convert.ToDateTime(reader.Value));
{{/isDate}}
{{/vendorExtensions.x-duplicated-data-type}}
{{/composedSchemas.anyOf}}
case JsonToken.StartObject:
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return {{classname}}.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -272,11 +272,39 @@
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
{{#composedSchemas.oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
{{#isInteger}}
case JsonToken.Integer:
return new {{classname}}(Convert.ToInt32(reader.Value));
{{/isInteger}}
{{#isNumber}}
case JsonToken.Float:
return new {{classname}}(Convert.ToDecimal(reader.Value));
{{/isNumber}}
{{#isString}}
case JsonToken.String:
return new {{classname}}(Convert.ToString(reader.Value));
{{/isString}}
{{#isBoolean}}
case JsonToken.Boolean:
return new {{classname}}(Convert.ToBoolean(reader.Value));
{{/isBoolean}}
{{#isDate}}
case JsonToken.Date:
return new {{classname}}(Convert.ToDateTime(reader.Value));
{{/isDate}}
{{/vendorExtensions.x-duplicated-data-type}}
{{/composedSchemas.oneOf}}
case JsonToken.StartObject:
return {{classname}}.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return {{classname}}.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -270,11 +270,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Fruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -279,11 +279,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return FruitReq.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -243,11 +243,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return GmFruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -343,11 +343,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Mammal.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -303,11 +303,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return NullableShape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return NullableShape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return NullableShape.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -224,11 +224,17 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return OneOfString.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.String:
return new OneOfString(Convert.ToString(reader.Value));
case JsonToken.StartObject:
return OneOfString.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return OneOfString.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -294,11 +294,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Pig.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Pig.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Pig.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -362,11 +362,19 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return PolymorphicProperty.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.Boolean:
return new PolymorphicProperty(Convert.ToBoolean(reader.Value));
case JsonToken.String:
return new PolymorphicProperty(Convert.ToString(reader.Value));
case JsonToken.StartObject:
return PolymorphicProperty.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return PolymorphicProperty.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -294,11 +294,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Quadrilateral.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Quadrilateral.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Quadrilateral.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -294,11 +294,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Shape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Shape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Shape.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -303,11 +303,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return ShapeOrNull.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return ShapeOrNull.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return ShapeOrNull.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -343,11 +343,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Triangle.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Triangle.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Triangle.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UseSourceGeneration", "src\UseSourceGeneration\UseSourceGeneration.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UseSourceGeneration.Test", "src\UseSourceGeneration.Test\UseSourceGeneration.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -121,6 +121,16 @@ namespace UseSourceGeneration.Test.Api
Assert.IsType<List<OuterEnum>>(model);
}
/// <summary>
/// Test TestAdditionalPropertiesReference
/// </summary>
[Fact (Skip = "not implemented")]
public async Task TestAdditionalPropertiesReferenceAsyncTest()
{
Dictionary<string, Object> requestBody = default!;
await _instance.TestAdditionalPropertiesReferenceAsync(requestBody);
}
/// <summary>
/// Test TestBodyWithFileSchema
/// </summary>
@@ -164,7 +174,7 @@ namespace UseSourceGeneration.Test.Api
decimal number = default!;
double varDouble = default!;
string patternWithoutDelimiter = default!;
Client.Option<DateTime> date = default!;
Client.Option<DateOnly> date = default!;
Client.Option<System.IO.Stream> binary = default!;
Client.Option<float> varFloat = default!;
Client.Option<int> integer = default!;
@@ -257,5 +267,15 @@ namespace UseSourceGeneration.Test.Api
Client.Option<string?> notRequiredNullable = default!;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
/// <summary>
/// Test TestStringMapReference
/// </summary>
[Fact (Skip = "not implemented")]
public async Task TestStringMapReferenceAsyncTest()
{
Dictionary<string, string> requestBody = default!;
await _instance.TestStringMapReferenceAsync(requestBody);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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 UseSourceGeneration.Model;
using UseSourceGeneration.Client;
using System.Reflection;
namespace UseSourceGeneration.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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 UseSourceGeneration.Model;
using UseSourceGeneration.Client;
using System.Reflection;
namespace UseSourceGeneration.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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 UseSourceGeneration.Model;
using UseSourceGeneration.Client;
using System.Reflection;
namespace UseSourceGeneration.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,65 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -1,11 +1,10 @@
# Org.OpenAPITools.Model.ChildCatAllOf
# Org.OpenAPITools.Model.MixedAnyOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat]
**Content** | [**MixedAnyOfContent**](MixedAnyOfContent.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.MixedAnyOfContent
Mixed anyOf types for testing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

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

View File

@@ -1,10 +1,9 @@
# Org.OpenAPITools.Model.CatAllOf
# Org.OpenAPITools.Model.MixedNullableEnumType
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Declawed** | **bool** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

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

View File

@@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.MixedOneOfContent
Mixed oneOf types for testing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,10 +1,10 @@
# Org.OpenAPITools.Model.UpdatePet200Response
# Org.OpenAPITools.Model.MixedSubId
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**VarString** | [**Pet**](Pet.md) | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedAnyOfContent
/// </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 MixedAnyOfContentTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedAnyOfContent
//private MixedAnyOfContent instance;
public MixedAnyOfContentTests()
{
// TODO uncomment below to create an instance of MixedAnyOfContent
//instance = new MixedAnyOfContent();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedAnyOfContent
/// </summary>
[Fact]
public void MixedAnyOfContentInstanceTest()
{
// TODO uncomment below to test "IsType" MixedAnyOfContent
//Assert.IsType<MixedAnyOfContent>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedAnyOf
/// </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 MixedAnyOfTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedAnyOf
//private MixedAnyOf instance;
public MixedAnyOfTests()
{
// TODO uncomment below to create an instance of MixedAnyOf
//instance = new MixedAnyOf();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedAnyOf
/// </summary>
[Fact]
public void MixedAnyOfInstanceTest()
{
// TODO uncomment below to test "IsType" MixedAnyOf
//Assert.IsType<MixedAnyOf>(instance);
}
/// <summary>
/// Test the property 'Content'
/// </summary>
[Fact]
public void ContentTest()
{
// TODO unit test for the property 'Content'
}
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedOneOfContent
/// </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 MixedOneOfContentTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedOneOfContent
//private MixedOneOfContent instance;
public MixedOneOfContentTests()
{
// TODO uncomment below to create an instance of MixedOneOfContent
//instance = new MixedOneOfContent();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedOneOfContent
/// </summary>
[Fact]
public void MixedOneOfContentInstanceTest()
{
// TODO uncomment below to test "IsType" MixedOneOfContent
//Assert.IsType<MixedOneOfContent>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedOneOf
/// </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 MixedOneOfTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedOneOf
//private MixedOneOf instance;
public MixedOneOfTests()
{
// TODO uncomment below to create an instance of MixedOneOf
//instance = new MixedOneOf();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedOneOf
/// </summary>
[Fact]
public void MixedOneOfInstanceTest()
{
// TODO uncomment below to test "IsType" MixedOneOf
//Assert.IsType<MixedOneOf>(instance);
}
/// <summary>
/// Test the property 'Content'
/// </summary>
[Fact]
public void ContentTest()
{
// TODO unit test for the property 'Content'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -271,11 +271,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Fruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -280,11 +280,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return FruitReq.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -244,11 +244,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return GmFruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -344,11 +344,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Mammal.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -21,55 +21,34 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// DogAllOf
/// MixedAnyOf
/// </summary>
[DataContract(Name = "Dog_allOf")]
public partial class DogAllOf : IEquatable<DogAllOf>, IValidatableObject
[DataContract(Name = "MixedAnyOf")]
public partial class MixedAnyOf : IEquatable<MixedAnyOf>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="DogAllOf" /> class.
/// Initializes a new instance of the <see cref="MixedAnyOf" /> class.
/// </summary>
/// <param name="breed">breed.</param>
public DogAllOf(string breed = default(string))
/// <param name="content">content.</param>
public MixedAnyOf(MixedAnyOfContent content = default(MixedAnyOfContent))
{
this._Breed = breed;
if (this.Breed != null)
{
this._flagBreed = true;
}
this.Content = content;
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets Breed
/// Gets or Sets Content
/// </summary>
[DataMember(Name = "breed", EmitDefaultValue = false)]
public string Breed
{
get{ return _Breed;}
set
{
_Breed = value;
_flagBreed = true;
}
}
private string _Breed;
private bool _flagBreed;
[DataMember(Name = "content", EmitDefaultValue = false)]
public MixedAnyOfContent Content { get; set; }
/// <summary>
/// Returns false as Breed should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeBreed()
{
return _flagBreed;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@@ -83,8 +62,8 @@ namespace Org.OpenAPITools.Model
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class DogAllOf {\n");
sb.Append(" Breed: ").Append(Breed).Append("\n");
sb.Append("class MixedAnyOf {\n");
sb.Append(" Content: ").Append(Content).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@@ -106,15 +85,15 @@ namespace Org.OpenAPITools.Model
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as DogAllOf).AreEqual;
return OpenAPIClientUtils.compareLogic.Compare(this, input as MixedAnyOf).AreEqual;
}
/// <summary>
/// Returns true if DogAllOf instances are equal
/// Returns true if MixedAnyOf instances are equal
/// </summary>
/// <param name="input">Instance of DogAllOf to be compared</param>
/// <param name="input">Instance of MixedAnyOf to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(DogAllOf input)
public bool Equals(MixedAnyOf input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@@ -128,9 +107,9 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Breed != null)
if (this.Content != null)
{
hashCode = (hashCode * 59) + this.Breed.GetHashCode();
hashCode = (hashCode * 59) + this.Content.GetHashCode();
}
if (this.AdditionalProperties != null)
{

View File

@@ -0,0 +1,391 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
using System.Reflection;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Mixed anyOf types for testing
/// </summary>
[JsonConverter(typeof(MixedAnyOfContentJsonConverter))]
[DataContract(Name = "MixedAnyOf_content")]
public partial class MixedAnyOfContent : AbstractOpenAPISchema, IEquatable<MixedAnyOfContent>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="string" /> class
/// </summary>
/// <param name="actualInstance">An instance of string.</param>
public MixedAnyOfContent(string actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="bool" /> class
/// </summary>
/// <param name="actualInstance">An instance of bool.</param>
public MixedAnyOfContent(bool actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="int" /> class
/// </summary>
/// <param name="actualInstance">An instance of int.</param>
public MixedAnyOfContent(int actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="decimal" /> class
/// </summary>
/// <param name="actualInstance">An instance of decimal.</param>
public MixedAnyOfContent(decimal actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="MixedSubId" /> class
/// </summary>
/// <param name="actualInstance">An instance of MixedSubId.</param>
public MixedAnyOfContent(MixedSubId actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
private Object _actualInstance;
/// <summary>
/// Gets or Sets ActualInstance
/// </summary>
public override Object ActualInstance
{
get
{
return _actualInstance;
}
set
{
if (value.GetType() == typeof(MixedSubId))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(int))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
{
this._actualInstance = value;
}
else
{
throw new ArgumentException("Invalid instance found. Must be the following types: MixedSubId, bool, decimal, int, string");
}
}
}
/// <summary>
/// Get the actual instance of `string`. If the actual instance is not `string`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of string</returns>
public string GetString()
{
return (string)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of bool</returns>
public bool GetBool()
{
return (bool)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `int`. If the actual instance is not `int`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of int</returns>
public int GetInt()
{
return (int)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `decimal`. If the actual instance is not `decimal`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of decimal</returns>
public decimal GetDecimal()
{
return (decimal)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `MixedSubId`. If the actual instance is not `MixedSubId`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of MixedSubId</returns>
public MixedSubId GetMixedSubId()
{
return (MixedSubId)this.ActualInstance;
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class MixedAnyOfContent {\n");
sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return JsonConvert.SerializeObject(this.ActualInstance, MixedAnyOfContent.SerializerSettings);
}
/// <summary>
/// Converts the JSON string into an instance of MixedAnyOfContent
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of MixedAnyOfContent</returns>
public static MixedAnyOfContent FromJson(string jsonString)
{
MixedAnyOfContent newMixedAnyOfContent = null;
if (string.IsNullOrEmpty(jsonString))
{
return newMixedAnyOfContent;
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<MixedSubId>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into MixedSubId: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<bool>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<decimal>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into decimal: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<int>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<string>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString()));
}
// no match found, throw an exception
throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined.");
}
/// <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 MixedAnyOfContent).AreEqual;
}
/// <summary>
/// Returns true if MixedAnyOfContent instances are equal
/// </summary>
/// <param name="input">Instance of MixedAnyOfContent to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(MixedAnyOfContent 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.ActualInstance != null)
hashCode = hashCode * 59 + this.ActualInstance.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// Custom JSON converter for MixedAnyOfContent
/// </summary>
public class MixedAnyOfContentJsonConverter : JsonConverter
{
/// <summary>
/// To write the JSON string
/// </summary>
/// <param name="writer">JSON writer</param>
/// <param name="value">Object to be converted into a JSON string</param>
/// <param name="serializer">JSON Serializer</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue((string)(typeof(MixedAnyOfContent).GetMethod("ToJson").Invoke(value, null)));
}
/// <summary>
/// To convert a JSON string into an object
/// </summary>
/// <param name="reader">JSON reader</param>
/// <param name="objectType">Object type</param>
/// <param name="existingValue">Existing value</param>
/// <param name="serializer">JSON Serializer</param>
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
switch(reader.TokenType)
{
case JsonToken.String:
return new MixedAnyOfContent(Convert.ToString(reader.Value));
case JsonToken.Boolean:
return new MixedAnyOfContent(Convert.ToBoolean(reader.Value));
case JsonToken.Integer:
return new MixedAnyOfContent(Convert.ToInt32(reader.Value));
case JsonToken.Float:
return new MixedAnyOfContent(Convert.ToDecimal(reader.Value));
case JsonToken.StartObject:
return MixedAnyOfContent.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return MixedAnyOfContent.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
}
/// <summary>
/// Check if the object can be converted
/// </summary>
/// <param name="objectType">Object type</param>
/// <returns>True if the object can be converted</returns>
public override bool CanConvert(Type objectType)
{
return false;
}
}
}

View File

@@ -0,0 +1,49 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Defines MixedEnumType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum MixedEnumType
{
/// <summary>
/// Enum SOMETHING for value: SOMETHING
/// </summary>
[EnumMember(Value = "SOMETHING")]
SOMETHING = 1,
/// <summary>
/// Enum OTHER for value: OTHER
/// </summary>
[EnumMember(Value = "OTHER")]
OTHER = 2
}
}

View File

@@ -0,0 +1,55 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Defines MixedNullableEnumType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum MixedNullableEnumType
{
/// <summary>
/// Enum SOMETHINGNULL for value: SOMETHING_NULL
/// </summary>
[EnumMember(Value = "SOMETHING_NULL")]
SOMETHINGNULL = 1,
/// <summary>
/// Enum SOMETHINGNEWED for value: SOMETHING_NEWED
/// </summary>
[EnumMember(Value = "SOMETHING_NEWED")]
SOMETHINGNEWED = 2,
/// <summary>
/// Enum Null for value: null
/// </summary>
[EnumMember(Value = "null")]
Null = 3
}
}

View File

@@ -21,55 +21,34 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// CatAllOf
/// MixedOneOf
/// </summary>
[DataContract(Name = "Cat_allOf")]
public partial class CatAllOf : IEquatable<CatAllOf>, IValidatableObject
[DataContract(Name = "MixedOneOf")]
public partial class MixedOneOf : IEquatable<MixedOneOf>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CatAllOf" /> class.
/// Initializes a new instance of the <see cref="MixedOneOf" /> class.
/// </summary>
/// <param name="declawed">declawed.</param>
public CatAllOf(bool declawed = default(bool))
/// <param name="content">content.</param>
public MixedOneOf(MixedOneOfContent content = default(MixedOneOfContent))
{
this._Declawed = declawed;
if (this.Declawed != null)
{
this._flagDeclawed = true;
}
this.Content = content;
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets Declawed
/// Gets or Sets Content
/// </summary>
[DataMember(Name = "declawed", EmitDefaultValue = true)]
public bool Declawed
{
get{ return _Declawed;}
set
{
_Declawed = value;
_flagDeclawed = true;
}
}
private bool _Declawed;
private bool _flagDeclawed;
[DataMember(Name = "content", EmitDefaultValue = false)]
public MixedOneOfContent Content { get; set; }
/// <summary>
/// Returns false as Declawed should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeDeclawed()
{
return _flagDeclawed;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@@ -83,8 +62,8 @@ namespace Org.OpenAPITools.Model
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class CatAllOf {\n");
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
sb.Append("class MixedOneOf {\n");
sb.Append(" Content: ").Append(Content).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@@ -106,15 +85,15 @@ namespace Org.OpenAPITools.Model
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as CatAllOf).AreEqual;
return OpenAPIClientUtils.compareLogic.Compare(this, input as MixedOneOf).AreEqual;
}
/// <summary>
/// Returns true if CatAllOf instances are equal
/// Returns true if MixedOneOf instances are equal
/// </summary>
/// <param name="input">Instance of CatAllOf to be compared</param>
/// <param name="input">Instance of MixedOneOf to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(CatAllOf input)
public bool Equals(MixedOneOf input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@@ -128,7 +107,10 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
hashCode = (hashCode * 59) + this.Declawed.GetHashCode();
if (this.Content != null)
{
hashCode = (hashCode * 59) + this.Content.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();

View File

@@ -0,0 +1,442 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
using System.Reflection;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Mixed oneOf types for testing
/// </summary>
[JsonConverter(typeof(MixedOneOfContentJsonConverter))]
[DataContract(Name = "MixedOneOf_content")]
public partial class MixedOneOfContent : AbstractOpenAPISchema, IEquatable<MixedOneOfContent>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="MixedOneOfContent" /> class
/// with the <see cref="string" /> class
/// </summary>
/// <param name="actualInstance">An instance of string.</param>
public MixedOneOfContent(string actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedOneOfContent" /> class
/// with the <see cref="bool" /> class
/// </summary>
/// <param name="actualInstance">An instance of bool.</param>
public MixedOneOfContent(bool actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedOneOfContent" /> class
/// with the <see cref="int" /> class
/// </summary>
/// <param name="actualInstance">An instance of int.</param>
public MixedOneOfContent(int actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedOneOfContent" /> class
/// with the <see cref="decimal" /> class
/// </summary>
/// <param name="actualInstance">An instance of decimal.</param>
public MixedOneOfContent(decimal actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedOneOfContent" /> class
/// with the <see cref="MixedSubId" /> class
/// </summary>
/// <param name="actualInstance">An instance of MixedSubId.</param>
public MixedOneOfContent(MixedSubId actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
private Object _actualInstance;
/// <summary>
/// Gets or Sets ActualInstance
/// </summary>
public override Object ActualInstance
{
get
{
return _actualInstance;
}
set
{
if (value.GetType() == typeof(MixedSubId))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(int))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
{
this._actualInstance = value;
}
else
{
throw new ArgumentException("Invalid instance found. Must be the following types: MixedSubId, bool, decimal, int, string");
}
}
}
/// <summary>
/// Get the actual instance of `string`. If the actual instance is not `string`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of string</returns>
public string GetString()
{
return (string)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of bool</returns>
public bool GetBool()
{
return (bool)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `int`. If the actual instance is not `int`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of int</returns>
public int GetInt()
{
return (int)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `decimal`. If the actual instance is not `decimal`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of decimal</returns>
public decimal GetDecimal()
{
return (decimal)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `MixedSubId`. If the actual instance is not `MixedSubId`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of MixedSubId</returns>
public MixedSubId GetMixedSubId()
{
return (MixedSubId)this.ActualInstance;
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class MixedOneOfContent {\n");
sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return JsonConvert.SerializeObject(this.ActualInstance, MixedOneOfContent.SerializerSettings);
}
/// <summary>
/// Converts the JSON string into an instance of MixedOneOfContent
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of MixedOneOfContent</returns>
public static MixedOneOfContent FromJson(string jsonString)
{
MixedOneOfContent newMixedOneOfContent = null;
if (string.IsNullOrEmpty(jsonString))
{
return newMixedOneOfContent;
}
int match = 0;
List<string> matchedTypes = new List<string>();
try
{
// if it does not contains "AdditionalProperties", use SerializerSettings to deserialize
if (typeof(MixedSubId).GetProperty("AdditionalProperties") == null)
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<MixedSubId>(jsonString, MixedOneOfContent.SerializerSettings));
}
else
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<MixedSubId>(jsonString, MixedOneOfContent.AdditionalPropertiesSerializerSettings));
}
matchedTypes.Add("MixedSubId");
match++;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into MixedSubId: {1}", jsonString, exception.ToString()));
}
try
{
// if it does not contains "AdditionalProperties", use SerializerSettings to deserialize
if (typeof(bool).GetProperty("AdditionalProperties") == null)
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<bool>(jsonString, MixedOneOfContent.SerializerSettings));
}
else
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<bool>(jsonString, MixedOneOfContent.AdditionalPropertiesSerializerSettings));
}
matchedTypes.Add("bool");
match++;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString()));
}
try
{
// if it does not contains "AdditionalProperties", use SerializerSettings to deserialize
if (typeof(decimal).GetProperty("AdditionalProperties") == null)
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<decimal>(jsonString, MixedOneOfContent.SerializerSettings));
}
else
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<decimal>(jsonString, MixedOneOfContent.AdditionalPropertiesSerializerSettings));
}
matchedTypes.Add("decimal");
match++;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into decimal: {1}", jsonString, exception.ToString()));
}
try
{
// if it does not contains "AdditionalProperties", use SerializerSettings to deserialize
if (typeof(int).GetProperty("AdditionalProperties") == null)
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<int>(jsonString, MixedOneOfContent.SerializerSettings));
}
else
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<int>(jsonString, MixedOneOfContent.AdditionalPropertiesSerializerSettings));
}
matchedTypes.Add("int");
match++;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString()));
}
try
{
// if it does not contains "AdditionalProperties", use SerializerSettings to deserialize
if (typeof(string).GetProperty("AdditionalProperties") == null)
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<string>(jsonString, MixedOneOfContent.SerializerSettings));
}
else
{
newMixedOneOfContent = new MixedOneOfContent(JsonConvert.DeserializeObject<string>(jsonString, MixedOneOfContent.AdditionalPropertiesSerializerSettings));
}
matchedTypes.Add("string");
match++;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString()));
}
if (match == 0)
{
throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined.");
}
else if (match > 1)
{
throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes));
}
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedOneOfContent;
}
/// <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 MixedOneOfContent).AreEqual;
}
/// <summary>
/// Returns true if MixedOneOfContent instances are equal
/// </summary>
/// <param name="input">Instance of MixedOneOfContent to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(MixedOneOfContent 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.ActualInstance != null)
hashCode = hashCode * 59 + this.ActualInstance.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// Custom JSON converter for MixedOneOfContent
/// </summary>
public class MixedOneOfContentJsonConverter : JsonConverter
{
/// <summary>
/// To write the JSON string
/// </summary>
/// <param name="writer">JSON writer</param>
/// <param name="value">Object to be converted into a JSON string</param>
/// <param name="serializer">JSON Serializer</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue((string)(typeof(MixedOneOfContent).GetMethod("ToJson").Invoke(value, null)));
}
/// <summary>
/// To convert a JSON string into an object
/// </summary>
/// <param name="reader">JSON reader</param>
/// <param name="objectType">Object type</param>
/// <param name="existingValue">Existing value</param>
/// <param name="serializer">JSON Serializer</param>
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
switch(reader.TokenType)
{
case JsonToken.String:
return new MixedOneOfContent(Convert.ToString(reader.Value));
case JsonToken.Boolean:
return new MixedOneOfContent(Convert.ToBoolean(reader.Value));
case JsonToken.Integer:
return new MixedOneOfContent(Convert.ToInt32(reader.Value));
case JsonToken.Float:
return new MixedOneOfContent(Convert.ToDecimal(reader.Value));
case JsonToken.StartObject:
return MixedOneOfContent.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return MixedOneOfContent.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
}
/// <summary>
/// Check if the object can be converted
/// </summary>
/// <param name="objectType">Object type</param>
/// <returns>True if the object can be converted</returns>
public override bool CanConvert(Type objectType)
{
return false;
}
}
}

View File

@@ -21,55 +21,34 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = Org.OpenAPITools.Client.FileParameter;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// UpdatePet200Response
/// MixedSubId
/// </summary>
[DataContract(Name = "updatePet_200_response")]
public partial class UpdatePet200Response : IEquatable<UpdatePet200Response>, IValidatableObject
[DataContract(Name = "MixedSubId")]
public partial class MixedSubId : IEquatable<MixedSubId>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdatePet200Response" /> class.
/// Initializes a new instance of the <see cref="MixedSubId" /> class.
/// </summary>
/// <param name="varString">varString.</param>
public UpdatePet200Response(Pet varString = default(Pet))
/// <param name="id">id.</param>
public MixedSubId(string id = default(string))
{
this._VarString = varString;
if (this.VarString != null)
{
this._flagVarString = true;
}
this.Id = id;
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets VarString
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "string", EmitDefaultValue = false)]
public Pet VarString
{
get{ return _VarString;}
set
{
_VarString = value;
_flagVarString = true;
}
}
private Pet _VarString;
private bool _flagVarString;
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Returns false as VarString should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeVarString()
{
return _flagVarString;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@@ -83,8 +62,8 @@ namespace Org.OpenAPITools.Model
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class UpdatePet200Response {\n");
sb.Append(" VarString: ").Append(VarString).Append("\n");
sb.Append("class MixedSubId {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@@ -106,15 +85,15 @@ namespace Org.OpenAPITools.Model
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as UpdatePet200Response).AreEqual;
return OpenAPIClientUtils.compareLogic.Compare(this, input as MixedSubId).AreEqual;
}
/// <summary>
/// Returns true if UpdatePet200Response instances are equal
/// Returns true if MixedSubId instances are equal
/// </summary>
/// <param name="input">Instance of UpdatePet200Response to be compared</param>
/// <param name="input">Instance of MixedSubId to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(UpdatePet200Response input)
public bool Equals(MixedSubId input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@@ -128,9 +107,9 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.VarString != null)
if (this.Id != null)
{
hashCode = (hashCode * 59) + this.VarString.GetHashCode();
hashCode = (hashCode * 59) + this.Id.GetHashCode();
}
if (this.AdditionalProperties != null)
{

View File

@@ -304,11 +304,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return NullableShape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return NullableShape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return NullableShape.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -225,11 +225,17 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return OneOfString.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.String:
return new OneOfString(Convert.ToString(reader.Value));
case JsonToken.StartObject:
return OneOfString.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return OneOfString.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -295,11 +295,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Pig.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Pig.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Pig.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -363,11 +363,19 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return PolymorphicProperty.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.Boolean:
return new PolymorphicProperty(Convert.ToBoolean(reader.Value));
case JsonToken.String:
return new PolymorphicProperty(Convert.ToString(reader.Value));
case JsonToken.StartObject:
return PolymorphicProperty.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return PolymorphicProperty.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -295,11 +295,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Quadrilateral.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Quadrilateral.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Quadrilateral.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -295,11 +295,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Shape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Shape.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Shape.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -304,11 +304,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return ShapeOrNull.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return ShapeOrNull.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return ShapeOrNull.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -344,11 +344,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Triangle.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Triangle.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Triangle.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -51,7 +51,12 @@ docs/List.md
docs/LiteralStringClass.md
docs/Mammal.md
docs/MapTest.md
docs/MixedAnyOf.md
docs/MixedAnyOfContent.md
docs/MixedOneOf.md
docs/MixedOneOfContent.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/MixedSubId.md
docs/Model200Response.md
docs/ModelClient.md
docs/Name.md
@@ -174,7 +179,12 @@ src/Org.OpenAPITools/Model/List.cs
src/Org.OpenAPITools/Model/LiteralStringClass.cs
src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MixedAnyOf.cs
src/Org.OpenAPITools/Model/MixedAnyOfContent.cs
src/Org.OpenAPITools/Model/MixedOneOf.cs
src/Org.OpenAPITools/Model/MixedOneOfContent.cs
src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs
src/Org.OpenAPITools/Model/MixedSubId.cs
src/Org.OpenAPITools/Model/Model200Response.cs
src/Org.OpenAPITools/Model/ModelClient.cs
src/Org.OpenAPITools/Model/Name.cs

View File

@@ -127,6 +127,8 @@ Class | Method | HTTP request | Description
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**GetMixedAnyOf**](docs/FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization
*FakeApi* | [**GetMixedOneOf**](docs/FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization
*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
@@ -210,7 +212,12 @@ Class | Method | HTTP request | Description
- [Model.LiteralStringClass](docs/LiteralStringClass.md)
- [Model.Mammal](docs/Mammal.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedAnyOf](docs/MixedAnyOf.md)
- [Model.MixedAnyOfContent](docs/MixedAnyOfContent.md)
- [Model.MixedOneOf](docs/MixedOneOf.md)
- [Model.MixedOneOfContent](docs/MixedOneOfContent.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.MixedSubId](docs/MixedSubId.md)
- [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelClient](docs/ModelClient.md)
- [Model.Name](docs/Name.md)

View File

@@ -1213,6 +1213,32 @@ paths:
summary: Array of Enums
tags:
- fake
/fake/mixed/anyOf:
get:
operationId: getMixedAnyOf
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/MixedAnyOf'
description: Got mixed anyOf
summary: Test mixed type anyOf deserialization
tags:
- fake
/fake/mixed/oneOf:
get:
operationId: getMixedOneOf
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/MixedOneOf'
description: Got mixed oneOf
summary: Test mixed type oneOf deserialization
tags:
- fake
/country:
post:
operationId: getCountry
@@ -2692,6 +2718,22 @@ components:
- a_objVariableobject
- pkiNotificationtestID
type: object
MixedOneOf:
example:
content: MixedOneOf_content
properties:
content:
$ref: '#/components/schemas/MixedOneOf_content'
MixedAnyOf:
example:
content: MixedAnyOf_content
properties:
content:
$ref: '#/components/schemas/MixedAnyOf_content'
MixedSubId:
properties:
id:
type: string
_foo_get_default_response:
example:
string:
@@ -2856,6 +2898,26 @@ components:
name:
type: string
type: object
MixedOneOf_content:
description: Mixed oneOf types for testing
oneOf:
- type: string
- type: boolean
- format: uint8
type: integer
- format: float32
type: number
- $ref: '#/components/schemas/MixedSubId'
MixedAnyOf_content:
anyOf:
- type: string
- type: boolean
- format: uint8
type: integer
- format: float32
type: number
- $ref: '#/components/schemas/MixedSubId'
description: Mixed anyOf types for testing
securitySchemes:
petstore_auth:
flows:

View File

@@ -10,6 +10,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | |
| [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | |
| [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums |
| [**GetMixedAnyOf**](FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization |
| [**GetMixedOneOf**](FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization |
| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties |
| [**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | |
| [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | |
@@ -549,6 +551,174 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a id="getmixedanyof"></a>
# **GetMixedAnyOf**
> MixedAnyOf GetMixedAnyOf ()
Test mixed type anyOf deserialization
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetMixedAnyOfExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(config);
try
{
// Test mixed type anyOf deserialization
MixedAnyOf result = apiInstance.GetMixedAnyOf();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.GetMixedAnyOf: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetMixedAnyOfWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Test mixed type anyOf deserialization
ApiResponse<MixedAnyOf> response = apiInstance.GetMixedAnyOfWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.GetMixedAnyOfWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**MixedAnyOf**](MixedAnyOf.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Got mixed anyOf | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a id="getmixedoneof"></a>
# **GetMixedOneOf**
> MixedOneOf GetMixedOneOf ()
Test mixed type oneOf deserialization
### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetMixedOneOfExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://petstore.swagger.io:80/v2";
var apiInstance = new FakeApi(config);
try
{
// Test mixed type oneOf deserialization
MixedOneOf result = apiInstance.GetMixedOneOf();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.GetMixedOneOf: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the GetMixedOneOfWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Test mixed type oneOf deserialization
ApiResponse<MixedOneOf> response = apiInstance.GetMixedOneOfWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FakeApi.GetMixedOneOfWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**MixedOneOf**](MixedOneOf.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Got mixed oneOf | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a id="testadditionalpropertiesreference"></a>
# **TestAdditionalPropertiesReference**
> void TestAdditionalPropertiesReference (Dictionary<string, Object> requestBody)

View File

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

View File

@@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.MixedAnyOfContent
Mixed anyOf types for testing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
# Org.OpenAPITools.Model.MixedOneOfContent
Mixed oneOf types for testing
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

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

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedAnyOfContent
/// </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 MixedAnyOfContentTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedAnyOfContent
//private MixedAnyOfContent instance;
public MixedAnyOfContentTests()
{
// TODO uncomment below to create an instance of MixedAnyOfContent
//instance = new MixedAnyOfContent();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedAnyOfContent
/// </summary>
[Fact]
public void MixedAnyOfContentInstanceTest()
{
// TODO uncomment below to test "IsType" MixedAnyOfContent
//Assert.IsType<MixedAnyOfContent>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedAnyOf
/// </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 MixedAnyOfTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedAnyOf
//private MixedAnyOf instance;
public MixedAnyOfTests()
{
// TODO uncomment below to create an instance of MixedAnyOf
//instance = new MixedAnyOf();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedAnyOf
/// </summary>
[Fact]
public void MixedAnyOfInstanceTest()
{
// TODO uncomment below to test "IsType" MixedAnyOf
//Assert.IsType<MixedAnyOf>(instance);
}
/// <summary>
/// Test the property 'Content'
/// </summary>
[Fact]
public void ContentTest()
{
// TODO unit test for the property 'Content'
}
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedEnumType
/// </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 MixedEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedEnumType
//private MixedEnumType instance;
public MixedEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedEnumType
//instance = new MixedEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedEnumType
/// </summary>
[Fact]
public void MixedEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedEnumType
//Assert.IsType<MixedEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedNullableEnumType
/// </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 MixedNullableEnumTypeTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedNullableEnumType
//private MixedNullableEnumType instance;
public MixedNullableEnumTypeTests()
{
// TODO uncomment below to create an instance of MixedNullableEnumType
//instance = new MixedNullableEnumType();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedNullableEnumType
/// </summary>
[Fact]
public void MixedNullableEnumTypeInstanceTest()
{
// TODO uncomment below to test "IsType" MixedNullableEnumType
//Assert.IsType<MixedNullableEnumType>(instance);
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedOneOfContent
/// </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 MixedOneOfContentTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedOneOfContent
//private MixedOneOfContent instance;
public MixedOneOfContentTests()
{
// TODO uncomment below to create an instance of MixedOneOfContent
//instance = new MixedOneOfContent();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedOneOfContent
/// </summary>
[Fact]
public void MixedOneOfContentInstanceTest()
{
// TODO uncomment below to test "IsType" MixedOneOfContent
//Assert.IsType<MixedOneOfContent>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedOneOf
/// </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 MixedOneOfTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedOneOf
//private MixedOneOf instance;
public MixedOneOfTests()
{
// TODO uncomment below to create an instance of MixedOneOf
//instance = new MixedOneOf();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedOneOf
/// </summary>
[Fact]
public void MixedOneOfInstanceTest()
{
// TODO uncomment below to test "IsType" MixedOneOf
//Assert.IsType<MixedOneOf>(instance);
}
/// <summary>
/// Test the property 'Content'
/// </summary>
[Fact]
public void ContentTest()
{
// TODO unit test for the property 'Content'
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing MixedSubId
/// </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 MixedSubIdTests : IDisposable
{
// TODO uncomment below to declare an instance variable for MixedSubId
//private MixedSubId instance;
public MixedSubIdTests()
{
// TODO uncomment below to create an instance of MixedSubId
//instance = new MixedSubId();
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of MixedSubId
/// </summary>
[Fact]
public void MixedSubIdInstanceTest()
{
// TODO uncomment below to test "IsType" MixedSubId
//Assert.IsType<MixedSubId>(instance);
}
/// <summary>
/// Test the property 'Id'
/// </summary>
[Fact]
public void IdTest()
{
// TODO unit test for the property 'Id'
}
}
}

View File

@@ -158,6 +158,42 @@ namespace Org.OpenAPITools.Api
/// <returns>ApiResponse of List&lt;OuterEnum&gt;</returns>
ApiResponse<List<OuterEnum>> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0);
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>MixedAnyOf</returns>
MixedAnyOf GetMixedAnyOf(int operationIndex = 0);
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of MixedAnyOf</returns>
ApiResponse<MixedAnyOf> GetMixedAnyOfWithHttpInfo(int operationIndex = 0);
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>MixedOneOf</returns>
MixedOneOf GetMixedOneOf(int operationIndex = 0);
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of MixedOneOf</returns>
ApiResponse<MixedOneOf> GetMixedOneOfWithHttpInfo(int operationIndex = 0);
/// <summary>
/// test referenced additionalProperties
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -643,6 +679,52 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse (List&lt;OuterEnum&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<OuterEnum>>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of MixedAnyOf</returns>
System.Threading.Tasks.Task<MixedAnyOf> GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (MixedAnyOf)</returns>
System.Threading.Tasks.Task<ApiResponse<MixedAnyOf>> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of MixedOneOf</returns>
System.Threading.Tasks.Task<MixedOneOf> GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (MixedOneOf)</returns>
System.Threading.Tasks.Task<ApiResponse<MixedOneOf>> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// test referenced additionalProperties
/// </summary>
/// <remarks>
@@ -1926,6 +2008,258 @@ namespace Org.OpenAPITools.Api
return localVarResponse;
}
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>MixedAnyOf</returns>
public MixedAnyOf GetMixedAnyOf(int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<MixedAnyOf> localVarResponse = GetMixedAnyOfWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of MixedAnyOf</returns>
public Org.OpenAPITools.Client.ApiResponse<MixedAnyOf> GetMixedAnyOfWithHttpInfo(int operationIndex = 0)
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = this.Client.Get<MixedAnyOf>("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of MixedAnyOf</returns>
public async System.Threading.Tasks.Task<MixedAnyOf> GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.ApiResponse<MixedAnyOf> localVarResponse = await GetMixedAnyOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// Test mixed type anyOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (MixedAnyOf)</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<MixedAnyOf>> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.GetAsync<MixedAnyOf>("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>MixedOneOf</returns>
public MixedOneOf GetMixedOneOf(int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<MixedOneOf> localVarResponse = GetMixedOneOfWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of MixedOneOf</returns>
public Org.OpenAPITools.Client.ApiResponse<MixedOneOf> GetMixedOneOfWithHttpInfo(int operationIndex = 0)
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = this.Client.Get<MixedOneOf>("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of MixedOneOf</returns>
public async System.Threading.Tasks.Task<MixedOneOf> GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.ApiResponse<MixedOneOf> localVarResponse = await GetMixedOneOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// Test mixed type oneOf deserialization
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (MixedOneOf)</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<MixedOneOf>> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.GetAsync<MixedOneOf>("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// test referenced additionalProperties
/// </summary>

View File

@@ -270,11 +270,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Fruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Fruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -279,11 +279,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return FruitReq.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return FruitReq.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -243,11 +243,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return GmFruit.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return GmFruit.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -343,11 +343,15 @@ namespace Org.OpenAPITools.Model
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.TokenType != JsonToken.Null)
switch(reader.TokenType)
{
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartObject:
return Mammal.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return Mammal.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
return null;
}
/// <summary>

View File

@@ -27,89 +27,27 @@ using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// ChildCatAllOf
/// MixedAnyOf
/// </summary>
[DataContract(Name = "ChildCat_allOf")]
public partial class ChildCatAllOf : IEquatable<ChildCatAllOf>, IValidatableObject
[DataContract(Name = "MixedAnyOf")]
public partial class MixedAnyOf : IEquatable<MixedAnyOf>, IValidatableObject
{
/// <summary>
/// Defines PetType
/// Initializes a new instance of the <see cref="MixedAnyOf" /> class.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum PetTypeEnum
/// <param name="content">content.</param>
public MixedAnyOf(MixedAnyOfContent content = default(MixedAnyOfContent))
{
/// <summary>
/// Enum ChildCat for value: ChildCat
/// </summary>
[EnumMember(Value = "ChildCat")]
ChildCat = 1
}
/// <summary>
/// Gets or Sets PetType
/// </summary>
[DataMember(Name = "pet_type", EmitDefaultValue = false)]
public PetTypeEnum? PetType
{
get{ return _PetType;}
set
{
_PetType = value;
_flagPetType = true;
}
}
private PetTypeEnum? _PetType;
private bool _flagPetType;
/// <summary>
/// Returns false as PetType should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializePetType()
{
return _flagPetType;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChildCatAllOf" /> class.
/// </summary>
/// <param name="name">name.</param>
/// <param name="petType">petType (default to PetTypeEnum.ChildCat).</param>
public ChildCatAllOf(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat)
{
this._Name = name;
if (this.Name != null)
{
this._flagName = true;
}
this.Content = content;
this.AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Gets or Sets Name
/// Gets or Sets Content
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name
{
get{ return _Name;}
set
{
_Name = value;
_flagName = true;
}
}
private string _Name;
private bool _flagName;
[DataMember(Name = "content", EmitDefaultValue = false)]
public MixedAnyOfContent Content { get; set; }
/// <summary>
/// Returns false as Name should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeName()
{
return _flagName;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@@ -123,9 +61,8 @@ namespace Org.OpenAPITools.Model
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class ChildCatAllOf {\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" PetType: ").Append(PetType).Append("\n");
sb.Append("class MixedAnyOf {\n");
sb.Append(" Content: ").Append(Content).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@@ -147,15 +84,15 @@ namespace Org.OpenAPITools.Model
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCatAllOf).AreEqual;
return OpenAPIClientUtils.compareLogic.Compare(this, input as MixedAnyOf).AreEqual;
}
/// <summary>
/// Returns true if ChildCatAllOf instances are equal
/// Returns true if MixedAnyOf instances are equal
/// </summary>
/// <param name="input">Instance of ChildCatAllOf to be compared</param>
/// <param name="input">Instance of MixedAnyOf to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ChildCatAllOf input)
public bool Equals(MixedAnyOf input)
{
return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
}
@@ -169,11 +106,10 @@ namespace Org.OpenAPITools.Model
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Name != null)
if (this.Content != null)
{
hashCode = (hashCode * 59) + this.Name.GetHashCode();
hashCode = (hashCode * 59) + this.Content.GetHashCode();
}
hashCode = (hashCode * 59) + this.PetType.GetHashCode();
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();

View File

@@ -0,0 +1,390 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
using System.Reflection;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Mixed anyOf types for testing
/// </summary>
[JsonConverter(typeof(MixedAnyOfContentJsonConverter))]
[DataContract(Name = "MixedAnyOf_content")]
public partial class MixedAnyOfContent : AbstractOpenAPISchema, IEquatable<MixedAnyOfContent>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="string" /> class
/// </summary>
/// <param name="actualInstance">An instance of string.</param>
public MixedAnyOfContent(string actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="bool" /> class
/// </summary>
/// <param name="actualInstance">An instance of bool.</param>
public MixedAnyOfContent(bool actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="int" /> class
/// </summary>
/// <param name="actualInstance">An instance of int.</param>
public MixedAnyOfContent(int actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="decimal" /> class
/// </summary>
/// <param name="actualInstance">An instance of decimal.</param>
public MixedAnyOfContent(decimal actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance;
}
/// <summary>
/// Initializes a new instance of the <see cref="MixedAnyOfContent" /> class
/// with the <see cref="MixedSubId" /> class
/// </summary>
/// <param name="actualInstance">An instance of MixedSubId.</param>
public MixedAnyOfContent(MixedSubId actualInstance)
{
this.IsNullable = false;
this.SchemaType= "anyOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
private Object _actualInstance;
/// <summary>
/// Gets or Sets ActualInstance
/// </summary>
public override Object ActualInstance
{
get
{
return _actualInstance;
}
set
{
if (value.GetType() == typeof(MixedSubId))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(bool))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(decimal))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(int))
{
this._actualInstance = value;
}
else if (value.GetType() == typeof(string))
{
this._actualInstance = value;
}
else
{
throw new ArgumentException("Invalid instance found. Must be the following types: MixedSubId, bool, decimal, int, string");
}
}
}
/// <summary>
/// Get the actual instance of `string`. If the actual instance is not `string`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of string</returns>
public string GetString()
{
return (string)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of bool</returns>
public bool GetBool()
{
return (bool)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `int`. If the actual instance is not `int`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of int</returns>
public int GetInt()
{
return (int)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `decimal`. If the actual instance is not `decimal`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of decimal</returns>
public decimal GetDecimal()
{
return (decimal)this.ActualInstance;
}
/// <summary>
/// Get the actual instance of `MixedSubId`. If the actual instance is not `MixedSubId`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of MixedSubId</returns>
public MixedSubId GetMixedSubId()
{
return (MixedSubId)this.ActualInstance;
}
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class MixedAnyOfContent {\n");
sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public override string ToJson()
{
return JsonConvert.SerializeObject(this.ActualInstance, MixedAnyOfContent.SerializerSettings);
}
/// <summary>
/// Converts the JSON string into an instance of MixedAnyOfContent
/// </summary>
/// <param name="jsonString">JSON string</param>
/// <returns>An instance of MixedAnyOfContent</returns>
public static MixedAnyOfContent FromJson(string jsonString)
{
MixedAnyOfContent newMixedAnyOfContent = null;
if (string.IsNullOrEmpty(jsonString))
{
return newMixedAnyOfContent;
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<MixedSubId>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into MixedSubId: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<bool>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<decimal>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into decimal: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<int>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString()));
}
try
{
newMixedAnyOfContent = new MixedAnyOfContent(JsonConvert.DeserializeObject<string>(jsonString, MixedAnyOfContent.SerializerSettings));
// deserialization is considered successful at this point if no exception has been thrown.
return newMixedAnyOfContent;
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString()));
}
// no match found, throw an exception
throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined.");
}
/// <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 MixedAnyOfContent).AreEqual;
}
/// <summary>
/// Returns true if MixedAnyOfContent instances are equal
/// </summary>
/// <param name="input">Instance of MixedAnyOfContent to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(MixedAnyOfContent 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.ActualInstance != null)
hashCode = hashCode * 59 + this.ActualInstance.GetHashCode();
return hashCode;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
/// <summary>
/// Custom JSON converter for MixedAnyOfContent
/// </summary>
public class MixedAnyOfContentJsonConverter : JsonConverter
{
/// <summary>
/// To write the JSON string
/// </summary>
/// <param name="writer">JSON writer</param>
/// <param name="value">Object to be converted into a JSON string</param>
/// <param name="serializer">JSON Serializer</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue((string)(typeof(MixedAnyOfContent).GetMethod("ToJson").Invoke(value, null)));
}
/// <summary>
/// To convert a JSON string into an object
/// </summary>
/// <param name="reader">JSON reader</param>
/// <param name="objectType">Object type</param>
/// <param name="existingValue">Existing value</param>
/// <param name="serializer">JSON Serializer</param>
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
switch(reader.TokenType)
{
case JsonToken.String:
return new MixedAnyOfContent(Convert.ToString(reader.Value));
case JsonToken.Boolean:
return new MixedAnyOfContent(Convert.ToBoolean(reader.Value));
case JsonToken.Integer:
return new MixedAnyOfContent(Convert.ToInt32(reader.Value));
case JsonToken.Float:
return new MixedAnyOfContent(Convert.ToDecimal(reader.Value));
case JsonToken.StartObject:
return MixedAnyOfContent.FromJson(JObject.Load(reader).ToString(Formatting.None));
case JsonToken.StartArray:
return MixedAnyOfContent.FromJson(JArray.Load(reader).ToString(Formatting.None));
default:
return null;
}
}
/// <summary>
/// Check if the object can be converted
/// </summary>
/// <param name="objectType">Object type</param>
/// <returns>True if the object can be converted</returns>
public override bool CanConvert(Type objectType)
{
return false;
}
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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 Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
namespace Org.OpenAPITools.Model
{
/// <summary>
/// Defines MixedEnumType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum MixedEnumType
{
/// <summary>
/// Enum SOMETHING for value: SOMETHING
/// </summary>
[EnumMember(Value = "SOMETHING")]
SOMETHING = 1,
/// <summary>
/// Enum OTHER for value: OTHER
/// </summary>
[EnumMember(Value = "OTHER")]
OTHER = 2
}
}

Some files were not shown because too many files have changed in this diff Show More