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 b5d2e170157e..1405dd77c79d 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
@@ -51,7 +51,7 @@
{{/-first}}
if (discriminator != null && discriminator.Equals("{{name}}"))
- return JsonSerializer.Deserialize<{{{name}}}>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+ return JsonSerializer.Deserialize<{{{classname}}}>(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
{{/children}}
{{/discriminator}}
@@ -348,7 +348,7 @@
{{#discriminator}}
{{#children}}
if ({{#lambda.paste}}{{/lambda.paste}} is {{classname}} {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}){
- JsonSerializer.Serialize<{{{name}}}>(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
+ JsonSerializer.Serialize<{{{classname}}}>(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}, jsonSerializerOptions);
return;
}
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 8980bb997e43..b2c1365f903c 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
@@ -2938,3 +2938,28 @@ components:
uuid:
type: string
format: uuid
+ CopyActivity:
+ type: object
+ required:
+ - $schema
+ - copyActivitytt
+ properties:
+ $schema:
+ type: string
+ enum:
+ - ScopeActivity
+ copyActivitytt:
+ type: string
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ EntityBase:
+ type: object
+ required:
+ - $schema
+ properties:
+ $schema:
+ type: string
+ discriminator:
+ propertyName: $schema
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
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 45c476af3183..b9a5acbac345 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
@@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@@ -187,11 +189,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.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 6b2a30f1db4c..2430a21de4fd 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
@@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/EntityBase.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 599ba401258a..66af4c79a0e3 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -169,6 +169,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)
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 c706302171c4..14e2fd920e83 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
@@ -60,11 +60,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
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 0bf16fb19b73..80e274401fdc 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
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -163,11 +165,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.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 780d21e19bfa..1214bb1bea44 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
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/EntityBase.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 231c516c999c..560c039d70a9 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -169,6 +169,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
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 e12f1ae97793..f4224c601f0c 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
@@ -58,11 +58,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
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 45c476af3183..b9a5acbac345 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
@@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@@ -187,11 +189,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.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 6b2a30f1db4c..2430a21de4fd 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
@@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/EntityBase.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 599ba401258a..66af4c79a0e3 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -169,6 +169,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
index c706302171c4..14e2fd920e83 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -60,11 +60,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net4.8/Petstore/.openapi-generator/FILES
index 0bf16fb19b73..80e274401fdc 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -163,11 +165,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/Petstore/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 231c516c999c..560c039d70a9 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -169,6 +169,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
index e12f1ae97793..f4224c601f0c 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -58,11 +58,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/FormModels/.openapi-generator/FILES
index bc72f8c05ba1..a1ef5edacd90 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/.openapi-generator/FILES
@@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@@ -189,11 +191,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
index 6b2a30f1db4c..2430a21de4fd 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
@@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net8/FormModels/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net8/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 32d03988e2d1..025b10ff3f0a 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -168,6 +168,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
index f35ca51d2d2a..a63f96c31ee9 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net8/NullReferenceTypes/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
index ec53dbda4326..caef12016777 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -170,6 +170,8 @@ public static string SanitizeFilename(string filename)
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 8be0791ee4fb..240e556b9b3e 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..6acd040dc2e8
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,228 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string? schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value!);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..fa8a54d9dd01
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,186 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/Petstore/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net8/Petstore/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net8/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index b8e281efd8ba..0dfe6afc4b13 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -168,6 +168,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
index cb0e43c85272..b2246d1a538b 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -60,11 +60,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net8/SourceGeneration/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
index ec53dbda4326..caef12016777 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -170,6 +170,8 @@ public static string SanitizeFilename(string filename)
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 03e2cd6ecb87..c7ce3c05913a 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
@@ -169,11 +171,13 @@ public HostConfiguration(IServiceCollection services)
new ChildCatSerializationContext(),
new ClassModelSerializationContext(),
new ComplexQuadrilateralSerializationContext(),
+ new CopyActivitySerializationContext(),
new DanishPigSerializationContext(),
new DateOnlyClassSerializationContext(),
new DeprecatedObjectSerializationContext(),
new DogSerializationContext(),
new DrawingSerializationContext(),
+ new EntityBaseSerializationContext(),
new EnumArraysSerializationContext(),
new EnumClassSerializationContext(),
new EnumTestSerializationContext(),
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..3fd719564b91
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,236 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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 System.Text.Json.Serialization.Metadata;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string? schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value!);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+
+ ///
+ /// The CopyActivitySerializationContext
+ ///
+ [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
+ [JsonSerializable(typeof(CopyActivity))]
+ public partial class CopyActivitySerializationContext : JsonSerializerContext { }
+}
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..c8e883631368
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,194 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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 System.Text.Json.Serialization.Metadata;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+
+ ///
+ /// The EntityBaseSerializationContext
+ ///
+ [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
+ [JsonSerializable(typeof(EntityBase))]
+ public partial class EntityBaseSerializationContext : JsonSerializerContext { }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES
index bc72f8c05ba1..a1ef5edacd90 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES
@@ -30,11 +30,13 @@ docs/models/ChildCat.md
docs/models/ChildCatAllOfPetType.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumArraysArrayEnumInner.md
docs/models/EnumArraysJustSymbol.md
@@ -189,11 +191,13 @@ src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs
src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
index 6b2a30f1db4c..2430a21de4fd 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
@@ -2694,6 +2694,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net9/FormModels/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net9/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
index 32d03988e2d1..025b10ff3f0a 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -168,6 +168,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCatAllOfPetType childCatAllOfPetType)
return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner)
return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner);
if (obj is EnumArraysJustSymbol enumArraysJustSymbol)
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
index f35ca51d2d2a..a63f96c31ee9 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net9/NullReferenceTypes/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
index ec53dbda4326..caef12016777 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -170,6 +170,8 @@ public static string SanitizeFilename(string filename)
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 8be0791ee4fb..240e556b9b3e 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..6acd040dc2e8
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,228 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string? schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value!);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..fa8a54d9dd01
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,186 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net9/Petstore/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net9/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index b8e281efd8ba..0dfe6afc4b13 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -168,6 +168,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
index cb0e43c85272..b2246d1a538b 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -60,11 +60,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES
index afb25a1c17e1..2c3e342eac8c 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -165,11 +167,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/net9/SourceGeneration/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
index ec53dbda4326..caef12016777 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -170,6 +170,8 @@ public static string SanitizeFilename(string filename)
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
index 03e2cd6ecb87..c7ce3c05913a 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -62,11 +62,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
@@ -169,11 +171,13 @@ public HostConfiguration(IServiceCollection services)
new ChildCatSerializationContext(),
new ClassModelSerializationContext(),
new ComplexQuadrilateralSerializationContext(),
+ new CopyActivitySerializationContext(),
new DanishPigSerializationContext(),
new DateOnlyClassSerializationContext(),
new DeprecatedObjectSerializationContext(),
new DogSerializationContext(),
new DrawingSerializationContext(),
+ new EntityBaseSerializationContext(),
new EnumArraysSerializationContext(),
new EnumClassSerializationContext(),
new EnumTestSerializationContext(),
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..3fd719564b91
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,236 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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 System.Text.Json.Serialization.Metadata;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string? schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value!);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+
+ ///
+ /// The CopyActivitySerializationContext
+ ///
+ [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
+ [JsonSerializable(typeof(CopyActivity))]
+ public partial class CopyActivitySerializationContext : JsonSerializerContext { }
+}
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..c8e883631368
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,194 @@
+//
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+#nullable enable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.IO;
+using System.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 System.Text.Json.Serialization.Metadata;
+using Org.OpenAPITools.Client;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class EntityBaseJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override EntityBase 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 schema = default;
+
+ string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$schema");
+
+ if (discriminator != null && discriminator.Equals("CopyActivity"))
+ return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value.");
+
+ 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 "$schema":
+ schema = new Option(utf8JsonReader.GetString()!);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class EntityBase.", nameof(schema));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class EntityBase.");
+
+ return new EntityBase();
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (entityBase is CopyActivity copyActivity){
+ JsonSerializer.Serialize(writer, copyActivity, jsonSerializerOptions);
+ return;
+ }
+
+ writer.WriteStartObject();
+
+ WriteProperties(writer, entityBase, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, EntityBase entityBase, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteString("$schema", entityBase.Schema);
+ }
+ }
+
+ ///
+ /// The EntityBaseSerializationContext
+ ///
+ [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)]
+ [JsonSerializable(typeof(EntityBase))]
+ public partial class EntityBaseSerializationContext : JsonSerializerContext { }
+}
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/.openapi-generator/FILES
index 0bf16fb19b73..80e274401fdc 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/.openapi-generator/FILES
@@ -29,11 +29,13 @@ docs/models/Category.md
docs/models/ChildCat.md
docs/models/ClassModel.md
docs/models/ComplexQuadrilateral.md
+docs/models/CopyActivity.md
docs/models/DanishPig.md
docs/models/DateOnlyClass.md
docs/models/DeprecatedObject.md
docs/models/Dog.md
docs/models/Drawing.md
+docs/models/EntityBase.md
docs/models/EnumArrays.md
docs/models/EnumClass.md
docs/models/EnumTest.md
@@ -163,11 +165,13 @@ src/Org.OpenAPITools/Model/Category.cs
src/Org.OpenAPITools/Model/ChildCat.cs
src/Org.OpenAPITools/Model/ClassModel.cs
src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs
+src/Org.OpenAPITools/Model/CopyActivity.cs
src/Org.OpenAPITools/Model/DanishPig.cs
src/Org.OpenAPITools/Model/DateOnlyClass.cs
src/Org.OpenAPITools/Model/DeprecatedObject.cs
src/Org.OpenAPITools/Model/Dog.cs
src/Org.OpenAPITools/Model/Drawing.cs
+src/Org.OpenAPITools/Model/EntityBase.cs
src/Org.OpenAPITools/Model/EnumArrays.cs
src/Org.OpenAPITools/Model/EnumClass.cs
src/Org.OpenAPITools/Model/EnumTest.cs
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
index 780d21e19bfa..1214bb1bea44 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
@@ -2872,6 +2872,31 @@ components:
uuid:
format: uuid
type: string
+ CopyActivity:
+ allOf:
+ - $ref: '#/components/schemas/EntityBase'
+ properties:
+ $schema:
+ enum:
+ - ScopeActivity
+ type: string
+ copyActivitytt:
+ type: string
+ required:
+ - $schema
+ - copyActivitytt
+ type: object
+ EntityBase:
+ discriminator:
+ mapping:
+ ScopeActivity: '#/components/schemas/CopyActivity'
+ propertyName: $schema
+ properties:
+ $schema:
+ type: string
+ required:
+ - $schema
+ type: object
_foo_get_default_response:
example:
string:
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/CopyActivity.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/CopyActivity.md
new file mode 100644
index 000000000000..eb13cef5182d
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/CopyActivity.md
@@ -0,0 +1,11 @@
+# Org.OpenAPITools.Model.CopyActivity
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**CopyActivitytt** | **string** | |
+**Schema** | **string** | | [default to SchemaEnum.ScopeActivity]
+
+[[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/standard2.0/Petstore/docs/models/EntityBase.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/EntityBase.md
new file mode 100644
index 000000000000..b00b029d2f0c
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/EntityBase.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.EntityBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Schema** | **string** | |
+
+[[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/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
new file mode 100644
index 000000000000..fbff5039599e
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/CopyActivityTests.cs
@@ -0,0 +1,74 @@
+/*
+ * 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 CopyActivity
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class CopyActivityTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for CopyActivity
+ //private CopyActivity instance;
+
+ public CopyActivityTests()
+ {
+ // TODO uncomment below to create an instance of CopyActivity
+ //instance = new CopyActivity();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of CopyActivity
+ ///
+ [Fact]
+ public void CopyActivityInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" CopyActivity
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test the property 'CopyActivitytt'
+ ///
+ [Fact]
+ public void CopyActivityttTest()
+ {
+ // TODO unit test for the property 'CopyActivitytt'
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
new file mode 100644
index 000000000000..7c7833da4fcb
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EntityBaseTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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 EntityBase
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class EntityBaseTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for EntityBase
+ //private EntityBase instance;
+
+ public EntityBaseTests()
+ {
+ // TODO uncomment below to create an instance of EntityBase
+ //instance = new EntityBase();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of EntityBase
+ ///
+ [Fact]
+ public void EntityBaseInstanceTest()
+ {
+ // TODO uncomment below to test "IsType" EntityBase
+ //Assert.IsType(instance);
+ }
+
+ ///
+ /// Test deserialize a CopyActivity from type EntityBase
+ ///
+ [Fact]
+ public void CopyActivityDeserializeFromEntityBaseTest()
+ {
+ // TODO uncomment below to test deserialize a CopyActivity from type EntityBase
+ //Assert.IsType(JsonConvert.DeserializeObject(new CopyActivity().ToJson()));
+ }
+
+ ///
+ /// Test the property 'Schema'
+ ///
+ [Fact]
+ public void SchemaTest()
+ {
+ // TODO unit test for the property 'Schema'
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 231c516c999c..560c039d70a9 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -169,6 +169,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
: "false";
if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum)
return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum);
+ if (obj is CopyActivity.SchemaEnum copyActivitySchemaEnum)
+ return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
index e12f1ae97793..f4224c601f0c 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs
@@ -58,11 +58,13 @@ public HostConfiguration(IServiceCollection services)
_jsonOptions.Converters.Add(new ChildCatJsonConverter());
_jsonOptions.Converters.Add(new ClassModelJsonConverter());
_jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter());
+ _jsonOptions.Converters.Add(new CopyActivityJsonConverter());
_jsonOptions.Converters.Add(new DanishPigJsonConverter());
_jsonOptions.Converters.Add(new DateOnlyClassJsonConverter());
_jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter());
_jsonOptions.Converters.Add(new DogJsonConverter());
_jsonOptions.Converters.Add(new DrawingJsonConverter());
+ _jsonOptions.Converters.Add(new EntityBaseJsonConverter());
_jsonOptions.Converters.Add(new EnumArraysJsonConverter());
_jsonOptions.Converters.Add(new EnumClassJsonConverter());
_jsonOptions.Converters.Add(new EnumClassNullableJsonConverter());
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
new file mode 100644
index 000000000000..7fbda7a016ba
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs
@@ -0,0 +1,226 @@
+//
+/*
+ * 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
+{
+ ///
+ /// CopyActivity
+ ///
+ public partial class CopyActivity : EntityBase, IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// copyActivitytt
+ [JsonConstructor]
+ public CopyActivity(string copyActivitytt) : base()
+ {
+ CopyActivitytt = copyActivitytt;
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// Defines Schema
+ ///
+ public enum SchemaEnum
+ {
+ ///
+ /// Enum ScopeActivity for value: ScopeActivity
+ ///
+ ScopeActivity = 1
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static SchemaEnum SchemaEnumFromString(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ throw new NotImplementedException($"Could not convert value to type SchemaEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static SchemaEnum? SchemaEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("ScopeActivity"))
+ return SchemaEnum.ScopeActivity;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string SchemaEnumToJsonValue(SchemaEnum value)
+ {
+ if (value == SchemaEnum.ScopeActivity)
+ return "ScopeActivity";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public new SchemaEnum Schema { get; } = (SchemaEnum)Enum.Parse(typeof(SchemaEnum), "CopyActivity");
+
+ ///
+ /// Gets or Sets CopyActivitytt
+ ///
+ [JsonPropertyName("copyActivitytt")]
+ public string CopyActivitytt { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class CopyActivity {\n");
+ sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n");
+ sb.Append(" CopyActivitytt: ").Append(CopyActivitytt).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+ }
+
+ ///
+ /// A Json converter for type
+ ///
+ public class CopyActivityJsonConverter : JsonConverter
+ {
+ ///
+ /// Deserializes json to
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override CopyActivity 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 schema = default;
+ Option copyActivitytt = 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 "$schema":
+ string schemaRawValue = utf8JsonReader.GetString();
+ if (schemaRawValue != null)
+ schema = new Option(CopyActivity.SchemaEnumFromStringOrDefault(schemaRawValue));
+ break;
+ case "copyActivitytt":
+ copyActivitytt = new Option(utf8JsonReader.GetString());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!schema.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(schema));
+
+ if (!copyActivitytt.IsSet)
+ throw new ArgumentException("Property is required for class CopyActivity.", nameof(copyActivitytt));
+
+ if (schema.IsSet && schema.Value == null)
+ throw new ArgumentNullException(nameof(schema), "Property is not nullable for class CopyActivity.");
+
+ if (copyActivitytt.IsSet && copyActivitytt.Value == null)
+ throw new ArgumentNullException(nameof(copyActivitytt), "Property is not nullable for class CopyActivity.");
+
+ return new CopyActivity(copyActivitytt.Value);
+ }
+
+ ///
+ /// Serializes a
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ writer.WriteStartObject();
+
+ WriteProperties(writer, copyActivity, jsonSerializerOptions);
+ writer.WriteEndObject();
+ }
+
+ ///
+ /// Serializes the properties of
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions)
+ {
+ if (copyActivity.CopyActivitytt == null)
+ throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity.");
+
+ writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema));
+
+ writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt);
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
new file mode 100644
index 000000000000..21bb6398df95
--- /dev/null
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EntityBase.cs
@@ -0,0 +1,184 @@
+//
+/*
+ * 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
+{
+ ///
+ /// EntityBase
+ ///
+ public partial class EntityBase : IValidatableObject
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructor]
+ public EntityBase()
+ {
+ OnCreated();
+ }
+
+ partial void OnCreated();
+
+ ///
+ /// The discriminator
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public string Schema { get; } = "EntityBase";
+
+ ///
+ /// 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 EntityBase {\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)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///