diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
index 595d919150f..b632d3b06d3 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
@@ -603,6 +603,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
property.name = patchPropertyName(model, camelize(property.baseType));
property.isNullable = true;
patchPropertyVendorExtensions(property);
+ property.vendorExtensions.put("x-base-name", model.name.substring(model.name.lastIndexOf('_') + 1));
}
}
@@ -613,6 +614,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
property.name = patchPropertyName(model, camelize(property.baseType));
property.isNullable = true;
patchPropertyVendorExtensions(property);
+ property.vendorExtensions.put("x-base-name", model.name.substring(model.name.lastIndexOf('_') + 1));
}
}
}
diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache
index 2b8fe63b201..189acfd7421 100644
--- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache
@@ -360,10 +360,24 @@
{{#model.hasDiscriminatorWithNonEmptyMapping}}
{{#composedSchemas.oneOf}}
{{^vendorExtensions.x-duplicated-data-type}}
- if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} != null) {
+ if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} != null)
+ {{#isPrimitiveType}}
+ {{#isString}}
+ writer.WriteString("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value);
+ {{/isString}}
+ {{#isBoolean}}
+ writer.WriteBoolean("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value.Value);
+ {{/isBoolean}}
+ {{#isNumeric}}
+ writer.WriteNumber("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value.Value);
+ {{/isNumeric}}
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
+ {
{{baseType}}JsonConverter {{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}} = ({{baseType}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}.GetType()));
{{#lambda.camelcase_sanitize_param}}{{baseType}}JsonConverter{{/lambda.camelcase_sanitize_param}}.WriteProperties(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
}
+ {{/isPrimitiveType}}
{{/vendorExtensions.x-duplicated-data-type}}
{{/composedSchemas.oneOf}}
@@ -373,10 +387,23 @@
{{#composedSchemas}}
{{#anyOf}}
if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet {{/required}}{{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}} != null{{/lambda.joinWithAmpersand}})
+ {{#isPrimitiveType}}
+ {{#isString}}
+ writer.WriteString("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value);
+ {{/isString}}
+ {{#isBoolean}}
+ writer.WriteBoolean("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value.Value);
+ {{/isBoolean}}
+ {{#isNumeric}}
+ writer.WriteNumber("{{vendorExtensions.x-base-name}}", {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value.Value);
+ {{/isNumeric}}
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
{
{{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}.GetType()));
{{datatypeWithEnum}}JsonConverter.WriteProperties(writer, {{#lambda.camelcase_sanitize_param}}{{model.classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{^required}}Option.Value{{/required}}, jsonSerializerOptions);
}
+ {{/isPrimitiveType}}
{{/anyOf}}
{{/composedSchemas}}
diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
index 21570bfa9ac..6809791b5e4 100644
--- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
@@ -1250,6 +1250,32 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
+ /fake/mixed/anyOf:
+ get:
+ tags:
+ - fake
+ summary: Test mixed type anyOf deserialization
+ operationId: getMixedAnyOf
+ responses:
+ 200:
+ description: Got mixed anyOf
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MixedAnyOf'
+ /fake/mixed/oneOf:
+ get:
+ tags:
+ - fake
+ summary: Test mixed type oneOf deserialization
+ operationId: getMixedOneOf
+ responses:
+ 200:
+ description: Got mixed oneOf
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MixedOneOf'
/country:
post:
operationId: getCountry
@@ -2753,6 +2779,41 @@ components:
type: array
items:
$ref: '#/components/schemas/Custom-Variableobject-Response'
+ MixedOneOf:
+ properties:
+ content:
+ oneOf:
+ - type: string
+ - type: boolean
+ # JsonReader will give back C# System.Int64 regardless of format.
+ - type: integer
+ format: uint8
+ # JsonReader will give back C# System.Double regardless of format.
+ - type: number
+ format: float32
+ - type: object
+ $ref: '#/components/schemas/MixedSubId'
+ description: Mixed oneOf types for testing
+ MixedAnyOf:
+ properties:
+ content:
+ anyOf:
+ - type: string
+ - type: boolean
+ # JsonReader will give back C# System.Int64 regardless of format.
+ - type: integer
+ format: uint8
+ # JsonReader will give back C# System.Double regardless of format.
+ - type: number
+ format: float32
+ - type: object
+ $ref: '#/components/schemas/MixedSubId'
+
+ description: Mixed anyOf types for testing
+ MixedSubId:
+ properties:
+ id:
+ type: string
# this class ensures that the CodegenProperties are sorted correctly
# https://github.com/OpenAPITools/openapi-generator/issues/18607
MixLog:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net4.7/FormModels/.openapi-generator/FILES
index 99f3f12f924..45c476af318 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/.openapi-generator/FILES
@@ -63,7 +63,12 @@ docs/models/Mammal.md
docs/models/MapTest.md
docs/models/MapTestMapOfEnumStringValue.md
docs/models/MixLog.md
+docs/models/MixedAnyOf.md
+docs/models/MixedAnyOfContent.md
+docs/models/MixedOneOf.md
+docs/models/MixedOneOfContent.md
docs/models/MixedPropertiesAndAdditionalPropertiesClass.md
+docs/models/MixedSubId.md
docs/models/Model200Response.md
docs/models/ModelClient.md
docs/models/Name.md
@@ -215,7 +220,12 @@ src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs
src/Org.OpenAPITools/Model/MixLog.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
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
index b4ab1bc2b81..c64890a0634 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
@@ -1182,6 +1182,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
@@ -2528,6 +2554,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
MixLog:
properties:
id:
@@ -2950,6 +2992,26 @@ components:
- unknown
- notUnknown
type: string
+ 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:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/FakeApi.md
index d87f500d56c..8e9abed3c22 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/FakeApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/FakeApi.md
@@ -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)
+
+# **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 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)
+
+
+# **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 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)
+
# **TestAdditionalPropertiesReference**
> void TestAdditionalPropertiesReference (Dictionary requestBody)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOf.md
new file mode 100644
index 00000000000..2e9a2ca23f6
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOfContent.md
new file mode 100644
index 00000000000..141ffe5a41d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedAnyOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedAnyOfContent
+Mixed anyOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOf.md
new file mode 100644
index 00000000000..6cb1d5adff0
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOfContent.md
new file mode 100644
index 00000000000..168d5ee8362
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedOneOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedOneOfContent
+Mixed oneOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedSubId.md
new file mode 100644
index 00000000000..1df3d4002bf
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/MixedSubId.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
index f57f666628d..00017fc4214 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
@@ -121,6 +121,28 @@ namespace Org.OpenAPITools.Test.Api
Assert.IsType>(model);
}
+ ///
+ /// Test GetMixedAnyOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedAnyOfAsyncTest()
+ {
+ var response = await _instance.GetMixedAnyOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
+ ///
+ /// Test GetMixedOneOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedOneOfAsyncTest()
+ {
+ var response = await _instance.GetMixedOneOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
///
/// Test TestAdditionalPropertiesReference
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
new file mode 100644
index 00000000000..4ce302d1d04
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOfContent
+ ///
+ [Fact]
+ public void MixedAnyOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
new file mode 100644
index 00000000000..53b28cc0658
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOf
+ ///
+ [Fact]
+ public void MixedAnyOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
new file mode 100644
index 00000000000..781b7202500
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOfContent
+ ///
+ [Fact]
+ public void MixedOneOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
new file mode 100644
index 00000000000..ee8b73d44f2
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOf
+ ///
+ [Fact]
+ public void MixedOneOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
new file mode 100644
index 00000000000..2ed728a41b8
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedSubId
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedSubId
+ ///
+ [Fact]
+ public void MixedSubIdInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedSubId
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Id'
+ ///
+ [Fact]
+ public void IdTest()
+ {
+ // TODO unit test for the property 'Id'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
index 0be949dd592..01eeeb00511 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
@@ -169,6 +169,48 @@ namespace Org.OpenAPITools.Api
/// <>
Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
/// test referenced additionalProperties
///
@@ -588,6 +630,30 @@ namespace Org.OpenAPITools.Api
bool IsOk { get; }
}
+ ///
+ /// The
+ ///
+ public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
+ ///
+ /// The
+ ///
+ public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
///
/// The
///
@@ -869,6 +935,46 @@ namespace Org.OpenAPITools.Api
OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedAnyOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedAnyOf;
+
+ internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse)
+ {
+ OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedAnyOf(Exception exception)
+ {
+ OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedOneOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedOneOf;
+
+ internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse)
+ {
+ OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedOneOf(Exception exception)
+ {
+ OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -2477,6 +2583,392 @@ namespace Org.OpenAPITools.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exception, string pathFormat, string path)
+ {
+ bool suppressDefaultLog = false;
+ OnErrorGetMixedAnyOf(ref suppressDefaultLog, exception, pathFormat, path);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf";
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorGetMixedAnyOf(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ public bool IsOk => 200 == (int)StatusCode;
+
+ ///
+ /// Deserializes the response if the response is 200 Ok
+ ///
+ ///
+ public Org.OpenAPITools.Model.MixedAnyOf Ok()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsOk
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 200 Ok and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result)
+ {
+ result = null;
+
+ try
+ {
+ result = Ok();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorGetMixedOneOfDefaultImplementation(Exception exception, string pathFormat, string path)
+ {
+ bool suppressDefaultLog = false;
+ OnErrorGetMixedOneOf(ref suppressDefaultLog, exception, pathFormat, path);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf";
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorGetMixedOneOf(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ public bool IsOk => 200 == (int)StatusCode;
+
+ ///
+ /// Deserializes the response if the response is 200 Ok
+ ///
+ ///
+ public Org.OpenAPITools.Model.MixedOneOf Ok()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsOk
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 200 Ok and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result)
+ {
+ result = null;
+
+ try
+ {
+ result = Ok();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody);
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 750d414c6e2..c706302171c 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -101,7 +101,12 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new MapTestMapOfEnumStringValueJsonConverter());
_jsonOptions.Converters.Add(new MapTestMapOfEnumStringValueNullableJsonConverter());
_jsonOptions.Converters.Add(new MixLogJsonConverter());
+ _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter());
+ _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter());
+ _jsonOptions.Converters.Add(new MixedOneOfJsonConverter());
+ _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter());
_jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter());
+ _jsonOptions.Converters.Add(new MixedSubIdJsonConverter());
_jsonOptions.Converters.Add(new Model200ResponseJsonConverter());
_jsonOptions.Converters.Add(new ModelClientJsonConverter());
_jsonOptions.Converters.Add(new NameJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Mammal.cs
index 1be5661d993..bb21f9f9baf 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Mammal.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Mammal.cs
@@ -232,17 +232,20 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (mammal.Whale != null) {
+ if (mammal.Whale != null)
+ {
WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType()));
whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions);
}
- if (mammal.Zebra != null) {
+ if (mammal.Zebra != null)
+ {
ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType()));
zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions);
}
- if (mammal.Pig != null) {
+ if (mammal.Pig != null)
+ {
PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType()));
pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs
new file mode 100644
index 00000000000..034925ec988
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs
@@ -0,0 +1,178 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedAnyOf
+ ///
+ public partial class MixedAnyOf : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// content
+ [JsonConstructor]
+ public MixedAnyOf(Option content = default)
+ {
+ ContentOption = content;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Content
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option ContentOption { get; private set; }
+
+ ///
+ /// Gets or Sets Content
+ ///
+ [JsonPropertyName("content")]
+ public MixedAnyOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedAnyOfJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option content = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "content":
+ if (utf8JsonReader.TokenType != JsonTokenType.Null)
+ content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (content.IsSet && content.Value == null)
+ throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf.");
+
+ return new MixedAnyOf(content);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedAnyOf, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null)
+ throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf.");
+
+ if (mixedAnyOf.ContentOption.IsSet)
+ {
+ writer.WritePropertyName("content");
+ JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions);
+ }
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs
new file mode 100644
index 00000000000..ac63c98cab6
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs
@@ -0,0 +1,283 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// Mixed anyOf types for testing
+ ///
+ public partial class MixedAnyOfContent : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId)
+ {
+ StringOption = @string;
+ BoolOption = @bool;
+ IntOption = @int;
+ DecimalOption = @decimal;
+ MixedSubIdOption = mixedSubId;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of String
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option StringOption { get; private set; }
+
+ ///
+ /// Gets or Sets String
+ ///
+ public string String { get { return this.StringOption; } set { this.StringOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Bool
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option BoolOption { get; private set; }
+
+ ///
+ /// Gets or Sets Bool
+ ///
+ public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Int
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option IntOption { get; private set; }
+
+ ///
+ /// Gets or Sets Int
+ ///
+ public int? Int { get { return this.IntOption; } set { this.IntOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Decimal
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option DecimalOption { get; private set; }
+
+ ///
+ /// Gets or Sets Decimal
+ ///
+ public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of MixedSubId
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option MixedSubIdOption { get; private set; }
+
+ ///
+ /// Gets or Sets MixedSubId
+ ///
+ public MixedSubId MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class MixedAnyOfContent {\n");
+ sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedAnyOfContentJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ string varString = default;
+ bool? varBool = default;
+ int? varInt = default;
+ decimal? varDecimal = default;
+ MixedSubId mixedSubId = default;
+
+ Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader;
+ while (utf8JsonReaderAnyOf.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth)
+ break;
+
+ if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1)
+ {
+ Utf8JsonReader utf8JsonReaderString = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString);
+
+ Utf8JsonReader utf8JsonReaderBool = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool);
+
+ Utf8JsonReader utf8JsonReaderInt = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt);
+
+ Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal);
+
+ Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId);
+ }
+ }
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ default:
+ break;
+ }
+ }
+ }
+
+ Option varStringParsedValue = varString == null
+ ? default
+ : new Option(varString);
+ Option varBoolParsedValue = varBool == null
+ ? default
+ : new Option(varBool);
+ Option varIntParsedValue = varInt == null
+ ? default
+ : new Option(varInt);
+ Option varDecimalParsedValue = varDecimal == null
+ ? default
+ : new Option(varDecimal);
+ Option mixedSubIdParsedValue = mixedSubId == null
+ ? default
+ : new Option(mixedSubId);
+
+ return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null)
+ writer.WriteString("content", mixedAnyOfContent.StringOption.Value);
+
+ if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null)
+ writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value);
+
+ if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null)
+ writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value);
+
+ if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null)
+ writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value);
+
+ if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null)
+ {
+ MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType()));
+ MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions);
+ }
+
+ WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs
new file mode 100644
index 00000000000..2045930184e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs
@@ -0,0 +1,178 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedOneOf
+ ///
+ public partial class MixedOneOf : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// content
+ [JsonConstructor]
+ public MixedOneOf(Option content = default)
+ {
+ ContentOption = content;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Content
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option ContentOption { get; private set; }
+
+ ///
+ /// Gets or Sets Content
+ ///
+ [JsonPropertyName("content")]
+ public MixedOneOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedOneOfJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option content = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "content":
+ if (utf8JsonReader.TokenType != JsonTokenType.Null)
+ content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (content.IsSet && content.Value == null)
+ throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf.");
+
+ return new MixedOneOf(content);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedOneOf, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null)
+ throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf.");
+
+ if (mixedOneOf.ContentOption.IsSet)
+ {
+ writer.WritePropertyName("content");
+ JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions);
+ }
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs
new file mode 100644
index 00000000000..0d8f554b021
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs
@@ -0,0 +1,261 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// Mixed oneOf types for testing
+ ///
+ public partial class MixedOneOfContent : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(string @string)
+ {
+ String = @string;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(bool @bool)
+ {
+ Bool = @bool;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(int @int)
+ {
+ Int = @int;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(decimal @decimal)
+ {
+ Decimal = @decimal;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(MixedSubId mixedSubId)
+ {
+ MixedSubId = mixedSubId;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Gets or Sets String
+ ///
+ public string String { get; set; }
+
+ ///
+ /// Gets or Sets Bool
+ ///
+ public bool? Bool { get; set; }
+
+ ///
+ /// Gets or Sets Int
+ ///
+ public int? Int { get; set; }
+
+ ///
+ /// Gets or Sets Decimal
+ ///
+ public decimal? Decimal { get; set; }
+
+ ///
+ /// Gets or Sets MixedSubId
+ ///
+ public MixedSubId MixedSubId { get; set; }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class MixedOneOfContent {\n");
+ sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedOneOfContentJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ string varString = default;
+ bool? varBool = default;
+ int? varInt = default;
+ decimal? varDecimal = default;
+ MixedSubId mixedSubId = default;
+
+ Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader;
+ while (utf8JsonReaderOneOf.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth)
+ break;
+
+ if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
+ {
+ Utf8JsonReader utf8JsonReaderString = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString);
+
+ Utf8JsonReader utf8JsonReaderBool = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool);
+
+ Utf8JsonReader utf8JsonReaderInt = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt);
+
+ Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal);
+
+ Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId);
+ }
+ }
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ default:
+ break;
+ }
+ }
+ }
+
+ if (varString != null)
+ return new MixedOneOfContent(varString);
+
+ if (varBool != null)
+ return new MixedOneOfContent(varBool.Value);
+
+ if (varInt != null)
+ return new MixedOneOfContent(varInt.Value);
+
+ if (varDecimal != null)
+ return new MixedOneOfContent(varDecimal.Value);
+
+ if (mixedSubId != null)
+ return new MixedOneOfContent(mixedSubId);
+
+ throw new JsonException();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs
new file mode 100644
index 00000000000..9766a9f410e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs
@@ -0,0 +1,174 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedSubId
+ ///
+ public partial class MixedSubId : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// id
+ [JsonConstructor]
+ public MixedSubId(Option id = default)
+ {
+ IdOption = id;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Id
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option IdOption { get; private set; }
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [JsonPropertyName("id")]
+ public string Id { get { return this.IdOption; } set { this.IdOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedSubIdJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option id = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "id":
+ id = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (id.IsSet && id.Value == null)
+ throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId.");
+
+ return new MixedSubId(id);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedSubId, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null)
+ throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId.");
+
+ if (mixedSubId.IdOption.IsSet)
+ writer.WriteString("id", mixedSubId.Id);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs
index 10061a2c228..48dabfec154 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (nullableShape.Triangle != null) {
+ if (nullableShape.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions);
}
- if (nullableShape.Quadrilateral != null) {
+ if (nullableShape.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pig.cs
index 19e395f1de4..20323876ffc 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pig.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pig.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (pig.BasquePig != null) {
+ if (pig.BasquePig != null)
+ {
BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType()));
basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions);
}
- if (pig.DanishPig != null) {
+ if (pig.DanishPig != null)
+ {
DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType()));
danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs
index 3d333d7958f..28fc8e1d46e 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (quadrilateral.SimpleQuadrilateral != null) {
+ if (quadrilateral.SimpleQuadrilateral != null)
+ {
SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType()));
simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions);
}
- if (quadrilateral.ComplexQuadrilateral != null) {
+ if (quadrilateral.ComplexQuadrilateral != null)
+ {
ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType()));
complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Shape.cs
index d4883a363a2..d6710bed609 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Shape.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Shape.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (shape.Triangle != null) {
+ if (shape.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions);
}
- if (shape.Quadrilateral != null) {
+ if (shape.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs
index 2d9fb2cbb33..03781409be7 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (shapeOrNull.Triangle != null) {
+ if (shapeOrNull.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions);
}
- if (shapeOrNull.Quadrilateral != null) {
+ if (shapeOrNull.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Triangle.cs
index d31d2948c65..9c9fee0db0b 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Triangle.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Triangle.cs
@@ -232,17 +232,20 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (triangle.EquilateralTriangle != null) {
+ if (triangle.EquilateralTriangle != null)
+ {
EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType()));
equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions);
}
- if (triangle.IsoscelesTriangle != null) {
+ if (triangle.IsoscelesTriangle != null)
+ {
IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType()));
isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions);
}
- if (triangle.ScaleneTriangle != null) {
+ if (triangle.ScaleneTriangle != null)
+ {
ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType()));
scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net4.7/Petstore/.openapi-generator/FILES
index be38ed26d98..0bf16fb19b7 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/.openapi-generator/FILES
@@ -55,7 +55,12 @@ docs/models/LiteralStringClass.md
docs/models/Mammal.md
docs/models/MapTest.md
docs/models/MixLog.md
+docs/models/MixedAnyOf.md
+docs/models/MixedAnyOfContent.md
+docs/models/MixedOneOf.md
+docs/models/MixedOneOfContent.md
docs/models/MixedPropertiesAndAdditionalPropertiesClass.md
+docs/models/MixedSubId.md
docs/models/Model200Response.md
docs/models/ModelClient.md
docs/models/Name.md
@@ -184,7 +189,12 @@ src/Org.OpenAPITools/Model/LiteralStringClass.cs
src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MixLog.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
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
index e4713d2621c..f772773afef 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
@@ -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
@@ -2706,6 +2732,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
MixLog:
properties:
id:
@@ -2974,6 +3016,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:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/FakeApi.md
index 46abf3716ff..959c6b75e78 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/FakeApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/FakeApi.md
@@ -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)
+
+# **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 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)
+
+
+# **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 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)
+
# **TestAdditionalPropertiesReference**
> void TestAdditionalPropertiesReference (Dictionary requestBody)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOf.md
new file mode 100644
index 00000000000..2e9a2ca23f6
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOfContent.md
new file mode 100644
index 00000000000..141ffe5a41d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedAnyOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedAnyOfContent
+Mixed anyOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOf.md
new file mode 100644
index 00000000000..6cb1d5adff0
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOfContent.md
new file mode 100644
index 00000000000..168d5ee8362
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedOneOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedOneOfContent
+Mixed oneOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedSubId.md
new file mode 100644
index 00000000000..1df3d4002bf
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/MixedSubId.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
index ee61aa92963..0cabe51ed28 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
@@ -121,6 +121,28 @@ namespace Org.OpenAPITools.Test.Api
Assert.IsType>(model);
}
+ ///
+ /// Test GetMixedAnyOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedAnyOfAsyncTest()
+ {
+ var response = await _instance.GetMixedAnyOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
+ ///
+ /// Test GetMixedOneOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedOneOfAsyncTest()
+ {
+ var response = await _instance.GetMixedOneOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
///
/// Test TestAdditionalPropertiesReference
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
new file mode 100644
index 00000000000..4ce302d1d04
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOfContent
+ ///
+ [Fact]
+ public void MixedAnyOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
new file mode 100644
index 00000000000..53b28cc0658
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOf
+ ///
+ [Fact]
+ public void MixedAnyOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
new file mode 100644
index 00000000000..781b7202500
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOfContent
+ ///
+ [Fact]
+ public void MixedOneOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
new file mode 100644
index 00000000000..ee8b73d44f2
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOf
+ ///
+ [Fact]
+ public void MixedOneOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
new file mode 100644
index 00000000000..2ed728a41b8
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedSubId
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedSubId
+ ///
+ [Fact]
+ public void MixedSubIdInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedSubId
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Id'
+ ///
+ [Fact]
+ public void IdTest()
+ {
+ // TODO unit test for the property 'Id'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs
index 677a0ab31c6..f0ab0b4ca0a 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs
@@ -169,6 +169,48 @@ namespace Org.OpenAPITools.Api
/// <>
Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
/// test referenced additionalProperties
///
@@ -588,6 +630,30 @@ namespace Org.OpenAPITools.Api
bool IsOk { get; }
}
+ ///
+ /// The
+ ///
+ public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
+ ///
+ /// The
+ ///
+ public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
///
/// The
///
@@ -869,6 +935,46 @@ namespace Org.OpenAPITools.Api
OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedAnyOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedAnyOf;
+
+ internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse)
+ {
+ OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedAnyOf(Exception exception)
+ {
+ OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedOneOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedOneOf;
+
+ internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse)
+ {
+ OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedOneOf(Exception exception)
+ {
+ OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -2477,6 +2583,392 @@ namespace Org.OpenAPITools.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exception, string pathFormat, string path)
+ {
+ bool suppressDefaultLog = false;
+ OnErrorGetMixedAnyOf(ref suppressDefaultLog, exception, pathFormat, path);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf";
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorGetMixedAnyOf(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ public bool IsOk => 200 == (int)StatusCode;
+
+ ///
+ /// Deserializes the response if the response is 200 Ok
+ ///
+ ///
+ public Org.OpenAPITools.Model.MixedAnyOf Ok()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsOk
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 200 Ok and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result)
+ {
+ result = null;
+
+ try
+ {
+ result = Ok();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorGetMixedOneOfDefaultImplementation(Exception exception, string pathFormat, string path)
+ {
+ bool suppressDefaultLog = false;
+ OnErrorGetMixedOneOf(ref suppressDefaultLog, exception, pathFormat, path);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf";
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorGetMixedOneOf(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ public bool IsOk => 200 == (int)StatusCode;
+
+ ///
+ /// Deserializes the response if the response is 200 Ok
+ ///
+ ///
+ public Org.OpenAPITools.Model.MixedOneOf Ok()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsOk
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 200 Ok and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result)
+ {
+ result = null;
+
+ try
+ {
+ result = Ok();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody);
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 8ea6690254f..e12f1ae9779 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -85,7 +85,12 @@ namespace Org.OpenAPITools.Client
_jsonOptions.Converters.Add(new MammalJsonConverter());
_jsonOptions.Converters.Add(new MapTestJsonConverter());
_jsonOptions.Converters.Add(new MixLogJsonConverter());
+ _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter());
+ _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter());
+ _jsonOptions.Converters.Add(new MixedOneOfJsonConverter());
+ _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter());
_jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter());
+ _jsonOptions.Converters.Add(new MixedSubIdJsonConverter());
_jsonOptions.Converters.Add(new Model200ResponseJsonConverter());
_jsonOptions.Converters.Add(new ModelClientJsonConverter());
_jsonOptions.Converters.Add(new NameJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs
index 1be5661d993..bb21f9f9baf 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs
@@ -232,17 +232,20 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (mammal.Whale != null) {
+ if (mammal.Whale != null)
+ {
WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType()));
whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions);
}
- if (mammal.Zebra != null) {
+ if (mammal.Zebra != null)
+ {
ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType()));
zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions);
}
- if (mammal.Pig != null) {
+ if (mammal.Pig != null)
+ {
PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType()));
pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs
new file mode 100644
index 00000000000..034925ec988
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs
@@ -0,0 +1,178 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedAnyOf
+ ///
+ public partial class MixedAnyOf : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// content
+ [JsonConstructor]
+ public MixedAnyOf(Option content = default)
+ {
+ ContentOption = content;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Content
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option ContentOption { get; private set; }
+
+ ///
+ /// Gets or Sets Content
+ ///
+ [JsonPropertyName("content")]
+ public MixedAnyOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedAnyOfJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option content = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "content":
+ if (utf8JsonReader.TokenType != JsonTokenType.Null)
+ content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (content.IsSet && content.Value == null)
+ throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf.");
+
+ return new MixedAnyOf(content);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedAnyOf, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null)
+ throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf.");
+
+ if (mixedAnyOf.ContentOption.IsSet)
+ {
+ writer.WritePropertyName("content");
+ JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions);
+ }
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs
new file mode 100644
index 00000000000..ac63c98cab6
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs
@@ -0,0 +1,283 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// Mixed anyOf types for testing
+ ///
+ public partial class MixedAnyOfContent : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId)
+ {
+ StringOption = @string;
+ BoolOption = @bool;
+ IntOption = @int;
+ DecimalOption = @decimal;
+ MixedSubIdOption = mixedSubId;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of String
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option StringOption { get; private set; }
+
+ ///
+ /// Gets or Sets String
+ ///
+ public string String { get { return this.StringOption; } set { this.StringOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Bool
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option BoolOption { get; private set; }
+
+ ///
+ /// Gets or Sets Bool
+ ///
+ public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Int
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option IntOption { get; private set; }
+
+ ///
+ /// Gets or Sets Int
+ ///
+ public int? Int { get { return this.IntOption; } set { this.IntOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of Decimal
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option DecimalOption { get; private set; }
+
+ ///
+ /// Gets or Sets Decimal
+ ///
+ public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new Option(value); } }
+
+ ///
+ /// Used to track the state of MixedSubId
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option MixedSubIdOption { get; private set; }
+
+ ///
+ /// Gets or Sets MixedSubId
+ ///
+ public MixedSubId MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class MixedAnyOfContent {\n");
+ sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedAnyOfContentJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ string varString = default;
+ bool? varBool = default;
+ int? varInt = default;
+ decimal? varDecimal = default;
+ MixedSubId mixedSubId = default;
+
+ Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader;
+ while (utf8JsonReaderAnyOf.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth)
+ break;
+
+ if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1)
+ {
+ Utf8JsonReader utf8JsonReaderString = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString);
+
+ Utf8JsonReader utf8JsonReaderBool = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool);
+
+ Utf8JsonReader utf8JsonReaderInt = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt);
+
+ Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal);
+
+ Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId);
+ }
+ }
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ default:
+ break;
+ }
+ }
+ }
+
+ Option varStringParsedValue = varString == null
+ ? default
+ : new Option(varString);
+ Option varBoolParsedValue = varBool == null
+ ? default
+ : new Option(varBool);
+ Option varIntParsedValue = varInt == null
+ ? default
+ : new Option(varInt);
+ Option varDecimalParsedValue = varDecimal == null
+ ? default
+ : new Option(varDecimal);
+ Option mixedSubIdParsedValue = mixedSubId == null
+ ? default
+ : new Option(mixedSubId);
+
+ return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null)
+ writer.WriteString("content", mixedAnyOfContent.StringOption.Value);
+
+ if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null)
+ writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value);
+
+ if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null)
+ writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value);
+
+ if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null)
+ writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value);
+
+ if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null)
+ {
+ MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType()));
+ MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions);
+ }
+
+ WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs
new file mode 100644
index 00000000000..2045930184e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs
@@ -0,0 +1,178 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedOneOf
+ ///
+ public partial class MixedOneOf : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// content
+ [JsonConstructor]
+ public MixedOneOf(Option content = default)
+ {
+ ContentOption = content;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Content
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option ContentOption { get; private set; }
+
+ ///
+ /// Gets or Sets Content
+ ///
+ [JsonPropertyName("content")]
+ public MixedOneOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedOneOfJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option content = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "content":
+ if (utf8JsonReader.TokenType != JsonTokenType.Null)
+ content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (content.IsSet && content.Value == null)
+ throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf.");
+
+ return new MixedOneOf(content);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedOneOf, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null)
+ throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf.");
+
+ if (mixedOneOf.ContentOption.IsSet)
+ {
+ writer.WritePropertyName("content");
+ JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions);
+ }
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs
new file mode 100644
index 00000000000..0d8f554b021
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs
@@ -0,0 +1,261 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// Mixed oneOf types for testing
+ ///
+ public partial class MixedOneOfContent : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(string @string)
+ {
+ String = @string;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(bool @bool)
+ {
+ Bool = @bool;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(int @int)
+ {
+ Int = @int;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(decimal @decimal)
+ {
+ Decimal = @decimal;
+ OnCreated();
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public MixedOneOfContent(MixedSubId mixedSubId)
+ {
+ MixedSubId = mixedSubId;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Gets or Sets String
+ ///
+ public string String { get; set; }
+
+ ///
+ /// Gets or Sets Bool
+ ///
+ public bool? Bool { get; set; }
+
+ ///
+ /// Gets or Sets Int
+ ///
+ public int? Int { get; set; }
+
+ ///
+ /// Gets or Sets Decimal
+ ///
+ public decimal? Decimal { get; set; }
+
+ ///
+ /// Gets or Sets MixedSubId
+ ///
+ public MixedSubId MixedSubId { get; set; }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class MixedOneOfContent {\n");
+ sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedOneOfContentJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ string varString = default;
+ bool? varBool = default;
+ int? varInt = default;
+ decimal? varDecimal = default;
+ MixedSubId mixedSubId = default;
+
+ Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader;
+ while (utf8JsonReaderOneOf.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth)
+ break;
+
+ if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1)
+ {
+ Utf8JsonReader utf8JsonReaderString = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString);
+
+ Utf8JsonReader utf8JsonReaderBool = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool);
+
+ Utf8JsonReader utf8JsonReaderInt = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt);
+
+ Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal);
+
+ Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader;
+ ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId);
+ }
+ }
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ default:
+ break;
+ }
+ }
+ }
+
+ if (varString != null)
+ return new MixedOneOfContent(varString);
+
+ if (varBool != null)
+ return new MixedOneOfContent(varBool.Value);
+
+ if (varInt != null)
+ return new MixedOneOfContent(varInt.Value);
+
+ if (varDecimal != null)
+ return new MixedOneOfContent(varDecimal.Value);
+
+ if (mixedSubId != null)
+ return new MixedOneOfContent(mixedSubId);
+
+ throw new JsonException();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions)
+ {
+
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs
new file mode 100644
index 00000000000..9766a9f410e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs
@@ -0,0 +1,174 @@
+//
+/*
+ * 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.Text;
+using System.Text.RegularExpressions;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// MixedSubId
+ ///
+ public partial class MixedSubId : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// id
+ [JsonConstructor]
+ public MixedSubId(Option id = default)
+ {
+ IdOption = id;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Used to track the state of Id
+ ///
+ [JsonIgnore]
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ public Option IdOption { get; private set; }
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [JsonPropertyName("id")]
+ public string Id { get { return this.IdOption; } set { this.IdOption = new Option(value); } }
+
+ ///
+ /// Gets or Sets additional properties
+ ///
+ [JsonExtensionData]
+ public Dictionary AdditionalProperties { get; } = new Dictionary();
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ 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();
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class MixedSubIdJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions)
+ {
+ int currentDepth = utf8JsonReader.CurrentDepth;
+
+ if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray)
+ throw new JsonException();
+
+ JsonTokenType startingTokenType = utf8JsonReader.TokenType;
+
+ Option id = default;
+
+ while (utf8JsonReader.Read())
+ {
+ if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth)
+ break;
+
+ if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1)
+ {
+ string localVarJsonPropertyName = utf8JsonReader.GetString();
+ utf8JsonReader.Read();
+
+ switch (localVarJsonPropertyName)
+ {
+ case "id":
+ id = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (id.IsSet && id.Value == null)
+ throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId.");
+
+ return new MixedSubId(id);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, mixedSubId, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null)
+ throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId.");
+
+ if (mixedSubId.IdOption.IsSet)
+ writer.WriteString("id", mixedSubId.Id);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs
index 10061a2c228..48dabfec154 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (nullableShape.Triangle != null) {
+ if (nullableShape.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions);
}
- if (nullableShape.Quadrilateral != null) {
+ if (nullableShape.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pig.cs
index 19e395f1de4..20323876ffc 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pig.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pig.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (pig.BasquePig != null) {
+ if (pig.BasquePig != null)
+ {
BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType()));
basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions);
}
- if (pig.DanishPig != null) {
+ if (pig.DanishPig != null)
+ {
DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType()));
danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs
index 3d333d7958f..28fc8e1d46e 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (quadrilateral.SimpleQuadrilateral != null) {
+ if (quadrilateral.SimpleQuadrilateral != null)
+ {
SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType()));
simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions);
}
- if (quadrilateral.ComplexQuadrilateral != null) {
+ if (quadrilateral.ComplexQuadrilateral != null)
+ {
ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType()));
complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Shape.cs
index d4883a363a2..d6710bed609 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Shape.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Shape.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (shape.Triangle != null) {
+ if (shape.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions);
}
- if (shape.Quadrilateral != null) {
+ if (shape.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs
index 2d9fb2cbb33..03781409be7 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs
@@ -208,12 +208,14 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (shapeOrNull.Triangle != null) {
+ if (shapeOrNull.Triangle != null)
+ {
TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType()));
triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions);
}
- if (shapeOrNull.Quadrilateral != null) {
+ if (shapeOrNull.Quadrilateral != null)
+ {
QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType()));
quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs
index d31d2948c65..9c9fee0db0b 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs
@@ -232,17 +232,20 @@ namespace Org.OpenAPITools.Model
{
writer.WriteStartObject();
- if (triangle.EquilateralTriangle != null) {
+ if (triangle.EquilateralTriangle != null)
+ {
EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType()));
equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions);
}
- if (triangle.IsoscelesTriangle != null) {
+ if (triangle.IsoscelesTriangle != null)
+ {
IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType()));
isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions);
}
- if (triangle.ScaleneTriangle != null) {
+ if (triangle.ScaleneTriangle != null)
+ {
ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType()));
scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net4.8/FormModels/.openapi-generator/FILES
index 99f3f12f924..45c476af318 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/.openapi-generator/FILES
@@ -63,7 +63,12 @@ docs/models/Mammal.md
docs/models/MapTest.md
docs/models/MapTestMapOfEnumStringValue.md
docs/models/MixLog.md
+docs/models/MixedAnyOf.md
+docs/models/MixedAnyOfContent.md
+docs/models/MixedOneOf.md
+docs/models/MixedOneOfContent.md
docs/models/MixedPropertiesAndAdditionalPropertiesClass.md
+docs/models/MixedSubId.md
docs/models/Model200Response.md
docs/models/ModelClient.md
docs/models/Name.md
@@ -215,7 +220,12 @@ src/Org.OpenAPITools/Model/Mammal.cs
src/Org.OpenAPITools/Model/MapTest.cs
src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs
src/Org.OpenAPITools/Model/MixLog.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
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
index b4ab1bc2b81..c64890a0634 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
@@ -1182,6 +1182,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
@@ -2528,6 +2554,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
MixLog:
properties:
id:
@@ -2950,6 +2992,26 @@ components:
- unknown
- notUnknown
type: string
+ 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:
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/FakeApi.md
index d87f500d56c..8e9abed3c22 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/FakeApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/FakeApi.md
@@ -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)
+
+# **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 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)
+
+
+# **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 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)
+
# **TestAdditionalPropertiesReference**
> void TestAdditionalPropertiesReference (Dictionary requestBody)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOf.md
new file mode 100644
index 00000000000..2e9a2ca23f6
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOfContent.md
new file mode 100644
index 00000000000..141ffe5a41d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedAnyOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedAnyOfContent
+Mixed anyOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOf.md
new file mode 100644
index 00000000000..6cb1d5adff0
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOf.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOfContent.md
new file mode 100644
index 00000000000..168d5ee8362
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedOneOfContent.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.MixedOneOfContent
+Mixed oneOf types for testing
+
+## 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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedSubId.md
new file mode 100644
index 00000000000..1df3d4002bf
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/MixedSubId.md
@@ -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)
+
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
index f57f666628d..00017fc4214 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs
@@ -121,6 +121,28 @@ namespace Org.OpenAPITools.Test.Api
Assert.IsType>(model);
}
+ ///
+ /// Test GetMixedAnyOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedAnyOfAsyncTest()
+ {
+ var response = await _instance.GetMixedAnyOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
+ ///
+ /// Test GetMixedOneOf
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task GetMixedOneOfAsyncTest()
+ {
+ var response = await _instance.GetMixedOneOfAsync();
+ var model = response.Ok();
+ Assert.IsType(model);
+ }
+
///
/// Test TestAdditionalPropertiesReference
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
new file mode 100644
index 00000000000..4ce302d1d04
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOfContent
+ ///
+ [Fact]
+ public void MixedAnyOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
new file mode 100644
index 00000000000..53b28cc0658
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedAnyOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedAnyOf
+ ///
+ [Fact]
+ public void MixedAnyOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedAnyOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
new file mode 100644
index 00000000000..781b7202500
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOfContent
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOfContent
+ ///
+ [Fact]
+ public void MixedOneOfContentInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOfContent
+ //Assert.IsType(instance);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
new file mode 100644
index 00000000000..ee8b73d44f2
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedOneOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedOneOf
+ ///
+ [Fact]
+ public void MixedOneOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedOneOf
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Content'
+ ///
+ [Fact]
+ public void ContentTest()
+ {
+ // TODO unit test for the property 'Content'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
new file mode 100644
index 00000000000..2ed728a41b8
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs
@@ -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
+{
+ ///
+ /// Class for testing MixedSubId
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ 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.
+ }
+
+ ///
+ /// Test an instance of MixedSubId
+ ///
+ [Fact]
+ public void MixedSubIdInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" MixedSubId
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'Id'
+ ///
+ [Fact]
+ public void IdTest()
+ {
+ // TODO unit test for the property 'Id'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
index 0be949dd592..01eeeb00511 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs
@@ -169,6 +169,48 @@ namespace Org.OpenAPITools.Api
/// <>
Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ /// Test mixed type oneOf deserialization
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
/// test referenced additionalProperties
///
@@ -588,6 +630,30 @@ namespace Org.OpenAPITools.Api
bool IsOk { get; }
}
+ ///
+ /// The
+ ///
+ public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
+ ///
+ /// The
+ ///
+ public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ {
+ ///
+ /// Returns true if the response is 200 Ok
+ ///
+ ///
+ bool IsOk { get; }
+ }
+
///
/// The
///
@@ -869,6 +935,46 @@ namespace Org.OpenAPITools.Api
OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedAnyOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedAnyOf;
+
+ internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse)
+ {
+ OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedAnyOf(Exception exception)
+ {
+ OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnGetMixedOneOf;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorGetMixedOneOf;
+
+ internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse)
+ {
+ OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorGetMixedOneOf(Exception exception)
+ {
+ OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -2477,6 +2583,392 @@ namespace Org.OpenAPITools.Api
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exception, string pathFormat, string path)
+ {
+ bool suppressDefaultLog = false;
+ OnErrorGetMixedAnyOf(ref suppressDefaultLog, exception, pathFormat, path);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path);
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Test mixed type anyOf deserialization
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ ///