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 469a22eabec3..68c0a012139a 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
@@ -251,7 +251,31 @@
{{^isNumeric}}
{{^isDate}}
{{^isDateTime}}
+ {{#isArray}}
+ {{#items.isEnum}}
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}null);
+ else
+ {
+ var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Items = new List<{{#items.isInnerEnum}}{{classname}}.{{/items.isInnerEnum}}{{{items.datatypeWithEnum}}}>();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string{{nrt?}} {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ItemRawValue = utf8JsonReader.GetString();
+ if ({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ItemRawValue != null)
+ {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Items.Add({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.FromStringOrDefault({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ItemRawValue){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}FromStringOrDefault({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}ItemRawValue){{/items.isInnerEnum}});
+ }
+ {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Items);
+ }
+ {{/items.isEnum}}
+ {{^items.isEnum}}
{{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^isNullable}}{{nrt!}}{{/isNullable}});
+ {{/items.isEnum}}
+ {{/isArray}}
+ {{^isArray}}
+ {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^isNullable}}{{nrt!}}{{/isNullable}});
+ {{/isArray}}
{{/isDateTime}}
{{/isDate}}
{{/isNumeric}}
@@ -612,14 +636,30 @@
if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} != null)
{
writer.WritePropertyName("{{baseName}}");
+ {{^items.isEnum}}
JsonSerializer.Serialize(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
+ {{/items.isEnum}}
+ {{#items.isEnum}}
+ writer.WriteStartArray();
+ foreach (var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item in {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}})
+ {{^items.isNumeric}}writer.WriteStringValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}{{#items.isNumeric}}writer.WriteNumberValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}
+ writer.WriteEndArray();
+ {{/items.isEnum}}
}
else
writer.WriteNull("{{baseName}}");
{{/isNullable}}
{{^isNullable}}
writer.WritePropertyName("{{baseName}}");
+ {{^items.isEnum}}
JsonSerializer.Serialize(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
+ {{/items.isEnum}}
+ {{#items.isEnum}}
+ writer.WriteStartArray();
+ foreach (var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item in {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}})
+ {{^items.isNumeric}}writer.WriteStringValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}{{#items.isNumeric}}writer.WriteNumberValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}
+ writer.WriteEndArray();
+ {{/items.isEnum}}
{{/isNullable}}
{{/required}}
{{^required}}
@@ -628,7 +668,15 @@
if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value != null)
{
writer.WritePropertyName("{{baseName}}");
+ {{^items.isEnum}}
JsonSerializer.Serialize(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
+ {{/items.isEnum}}
+ {{#items.isEnum}}
+ writer.WriteStartArray();
+ foreach (var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item in {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.Value{{nrt!}})
+ {{^items.isNumeric}}writer.WriteStringValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}{{#items.isNumeric}}writer.WriteNumberValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}
+ writer.WriteEndArray();
+ {{/items.isEnum}}
}
else
writer.WriteNull("{{baseName}}");
@@ -636,7 +684,15 @@
{{^isNullable}}
{
writer.WritePropertyName("{{baseName}}");
+ {{^items.isEnum}}
JsonSerializer.Serialize(writer, {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}, jsonSerializerOptions);
+ {{/items.isEnum}}
+ {{#items.isEnum}}
+ writer.WriteStartArray();
+ foreach (var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item in {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}{{nrt!}})
+ {{^items.isNumeric}}writer.WriteStringValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}{{#items.isNumeric}}writer.WriteNumberValue({{^items.isInnerEnum}}{{{items.datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}}{{#items.isInnerEnum}}{{classname}}.{{{items.datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Item){{/items.isInnerEnum}});{{/items.isNumeric}}
+ writer.WriteEndArray();
+ {{/items.isEnum}}
}
{{/isNullable}}
{{/required}}
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 2abbde0932ad..01270e9628c1 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
@@ -2090,6 +2090,14 @@ components:
enum:
- fish
- crab
+ array_enum_nullable:
+ type: array
+ nullable: true
+ items:
+ type: string
+ enum:
+ - fish
+ - crab
FreeFormObject:
type: object
description: A schema consisting only of additional properties
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/api/openapi.yaml b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/api/openapi.yaml
index a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Client/ClientUtils.cs
index 6f17300f7494..0bbc23af5d77 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -149,6 +149,8 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs
index bc9917434f4a..f322be6eb341 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -34,11 +34,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option?> arrayEnum = default, Option?> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -111,6 +113,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum? value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -203,6 +271,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List? ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option?> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List? ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Returns the string presentation of the object
///
@@ -212,6 +293,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append("}\n");
return sb.ToString();
@@ -251,6 +333,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option?> arrayEnum = default;
+ Option?> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -269,7 +352,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!);
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option?>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option?>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option?>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option?>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string? justSymbolRawValue = utf8JsonReader.GetString();
@@ -288,7 +402,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -321,8 +435,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs
index acec1f83e975..82a3c9c61f8c 100644
--- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs
@@ -323,7 +323,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString!)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml
index 8e6e916f99eb..3e5095bfa2c4 100644
--- a/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml
@@ -1942,6 +1942,11 @@ components:
items:
$ref: "#/components/schemas/EnumArrays_array_enum_inner"
type: array
+ array_enum_nullable:
+ items:
+ $ref: "#/components/schemas/EnumArrays_array_enum_inner"
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net10/FormModels/docs/models/EnumArrays.md
index ae3e81632c1b..e56a9d351032 100644
--- a/samples/client/petstore/csharp/generichost/net10/FormModels/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net10/FormModels/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
+**ArrayEnumNullable** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
**JustSymbol** | **EnumArraysJustSymbol** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
index ef41971722d9..8fcd25fb727a 100644
--- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -70,6 +72,19 @@ public EnumArrays(Option> arrayEnum = default, Op
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -85,6 +100,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -125,6 +141,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -145,6 +162,9 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
case "array_enum":
arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
break;
+ case "array_enum_nullable":
+ arrayEnumNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
if (justSymbolRawValue != null)
@@ -162,7 +182,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -197,6 +217,14 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
writer.WritePropertyName("array_enum");
JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ JsonSerializer.Serialize(writer, enumArrays.ArrayEnumNullable, jsonSerializerOptions);
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
if (enumArrays.JustSymbolOption.IsSet)
{
var justSymbolRawValue = EnumArraysJustSymbolValueConverter.ToJsonValue(enumArrays.JustSymbol.Value);
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml
index a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
index f442dd44bfa2..b3b25b83f8a5 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -164,6 +164,8 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
index f2e96952c4bb..6f9a624aec8e 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -35,11 +35,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option?> arrayEnum = default, Option?> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -112,6 +114,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum? value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -204,6 +272,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List? ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option?> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List? ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -219,6 +300,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -259,6 +341,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option?> arrayEnum = default;
+ Option?> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -277,7 +360,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!);
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option?>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option?>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option?>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option?>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string? justSymbolRawValue = utf8JsonReader.GetString();
@@ -296,7 +410,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -329,8 +443,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
index e9ed8d747187..473b76ca035f 100644
--- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
@@ -331,7 +331,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString!)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml
index a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net10/Petstore/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
index 9ea7d8118c3b..20ceb86959aa 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -162,6 +162,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
index 43b688de6dd5..a90c1304bd40 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -110,6 +112,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -202,6 +270,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -217,6 +298,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -257,6 +339,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -275,7 +358,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
@@ -294,7 +408,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -327,8 +441,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
index 7ba0cf8f07b4..f85d31b54962 100644
--- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
@@ -329,7 +329,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml
index a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
index f442dd44bfa2..b3b25b83f8a5 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs
@@ -164,6 +164,8 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
index 4a8e487309f0..a4f2141612ba 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -36,11 +36,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option?> arrayEnum = default, Option?> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -113,6 +115,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum? value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -205,6 +273,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List? ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option?> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List? ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -220,6 +301,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -260,6 +342,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option?> arrayEnum = default;
+ Option?> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -278,7 +361,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!);
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option?>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option?>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option?>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option?>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string? justSymbolRawValue = utf8JsonReader.GetString();
@@ -297,7 +411,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -330,8 +444,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
index 63057540d6ae..9adf4649059e 100644
--- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
@@ -332,7 +332,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString!)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 8e6e916f99eb..3e5095bfa2c4 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
@@ -1942,6 +1942,11 @@ components:
items:
$ref: "#/components/schemas/EnumArrays_array_enum_inner"
type: array
+ array_enum_nullable:
+ items:
+ $ref: "#/components/schemas/EnumArrays_array_enum_inner"
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EnumArrays.md
index ae3e81632c1b..e56a9d351032 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
+**ArrayEnumNullable** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
**JustSymbol** | **EnumArraysJustSymbol** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
index 13184691ed86..67d43a6abdf9 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -70,6 +72,19 @@ public EnumArrays(Option> arrayEnum = default, Op
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new Option>(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new Option>(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -85,6 +100,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -125,6 +141,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -145,6 +162,9 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
case "array_enum":
arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
break;
+ case "array_enum_nullable":
+ arrayEnumNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
if (justSymbolRawValue != null)
@@ -162,7 +182,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -197,6 +217,14 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
writer.WritePropertyName("array_enum");
JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ JsonSerializer.Serialize(writer, enumArrays.ArrayEnumNullable, jsonSerializerOptions);
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
if (enumArrays.JustSymbolOption.IsSet)
{
var justSymbolRawValue = EnumArraysJustSymbolValueConverter.ToJsonValue(enumArrays.JustSymbol.Value);
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 a179b6cfdd29..a33bcf6b30b4 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
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
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 92d95ba94060..118e592aee62 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
@@ -163,6 +163,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
index e285c7523d4c..eab30860a496 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -110,6 +112,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -202,6 +270,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new Option>(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new Option>(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -217,6 +298,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -257,6 +339,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -275,7 +358,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
@@ -294,7 +408,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -327,8 +441,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
index 6f322da6a9bf..3b2a67cfac2a 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
@@ -329,7 +329,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 8e6e916f99eb..3e5095bfa2c4 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
@@ -1942,6 +1942,11 @@ components:
items:
$ref: "#/components/schemas/EnumArrays_array_enum_inner"
type: array
+ array_enum_nullable:
+ items:
+ $ref: "#/components/schemas/EnumArrays_array_enum_inner"
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EnumArrays.md
index ae3e81632c1b..e56a9d351032 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
+**ArrayEnumNullable** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
**JustSymbol** | **EnumArraysJustSymbol** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
index 13184691ed86..67d43a6abdf9 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -70,6 +72,19 @@ public EnumArrays(Option> arrayEnum = default, Op
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new Option>(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new Option>(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -85,6 +100,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -125,6 +141,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -145,6 +162,9 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
case "array_enum":
arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
break;
+ case "array_enum_nullable":
+ arrayEnumNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
if (justSymbolRawValue != null)
@@ -162,7 +182,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -197,6 +217,14 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
writer.WritePropertyName("array_enum");
JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ JsonSerializer.Serialize(writer, enumArrays.ArrayEnumNullable, jsonSerializerOptions);
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
if (enumArrays.JustSymbolOption.IsSet)
{
var justSymbolRawValue = EnumArraysJustSymbolValueConverter.ToJsonValue(enumArrays.JustSymbol.Value);
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 a179b6cfdd29..a33bcf6b30b4 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
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
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 92d95ba94060..118e592aee62 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
@@ -163,6 +163,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
index e285c7523d4c..eab30860a496 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -110,6 +112,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -202,6 +270,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new Option>(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new Option>(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -217,6 +298,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -257,6 +339,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -275,7 +358,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
@@ -294,7 +408,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -327,8 +441,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
index 6f322da6a9bf..3b2a67cfac2a 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
@@ -329,7 +329,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 8e6e916f99eb..3e5095bfa2c4 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
@@ -1942,6 +1942,11 @@ components:
items:
$ref: "#/components/schemas/EnumArrays_array_enum_inner"
type: array
+ array_enum_nullable:
+ items:
+ $ref: "#/components/schemas/EnumArrays_array_enum_inner"
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EnumArrays.md
index ae3e81632c1b..e56a9d351032 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
+**ArrayEnumNullable** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
**JustSymbol** | **EnumArraysJustSymbol** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
index ef41971722d9..8fcd25fb727a 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -70,6 +72,19 @@ public EnumArrays(Option> arrayEnum = default, Op
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -85,6 +100,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -125,6 +141,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -145,6 +162,9 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
case "array_enum":
arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
break;
+ case "array_enum_nullable":
+ arrayEnumNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
if (justSymbolRawValue != null)
@@ -162,7 +182,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -197,6 +217,14 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
writer.WritePropertyName("array_enum");
JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ JsonSerializer.Serialize(writer, enumArrays.ArrayEnumNullable, jsonSerializerOptions);
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
if (enumArrays.JustSymbolOption.IsSet)
{
var justSymbolRawValue = EnumArraysJustSymbolValueConverter.ToJsonValue(enumArrays.JustSymbol.Value);
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 a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
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 f442dd44bfa2..b3b25b83f8a5 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
@@ -164,6 +164,8 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
index f2e96952c4bb..6f9a624aec8e 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -35,11 +35,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option?> arrayEnum = default, Option?> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -112,6 +114,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum? value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -204,6 +272,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List? ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option?> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List? ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -219,6 +300,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -259,6 +341,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option?> arrayEnum = default;
+ Option?> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -277,7 +360,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!);
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option?>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option?>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option?>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option?>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string? justSymbolRawValue = utf8JsonReader.GetString();
@@ -296,7 +410,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -329,8 +443,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
index e9ed8d747187..473b76ca035f 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs
@@ -331,7 +331,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString!)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
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 9ea7d8118c3b..20ceb86959aa 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
@@ -162,6 +162,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
index 43b688de6dd5..a90c1304bd40 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -110,6 +112,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -202,6 +270,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -217,6 +298,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -257,6 +339,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -275,7 +358,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions));
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string justSymbolRawValue = utf8JsonReader.GetString();
@@ -294,7 +408,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -327,8 +441,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
index 7ba0cf8f07b4..f85d31b54962 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs
@@ -329,7 +329,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 a179b6cfdd29..a33bcf6b30b4 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
@@ -2025,6 +2025,14 @@ components:
- crab
type: string
type: array
+ array_enum_nullable:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EnumArrays.md
index 7467f67978c5..70c96be2c716 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional]
+**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [optional]
**JustSymbol** | **string** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
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 f442dd44bfa2..b3b25b83f8a5 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
@@ -164,6 +164,8 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp
return CopyActivity.SchemaEnumToJsonValue(copyActivitySchemaEnum);
if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum)
return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum);
+ if (obj is EnumArrays.ArrayEnumNullableEnum enumArraysArrayEnumNullableEnum)
+ return EnumArrays.ArrayEnumNullableEnumToJsonValue(enumArraysArrayEnumNullableEnum);
if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum)
return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum);
if (obj is EnumClass enumClass)
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
index 4a8e487309f0..a4f2141612ba 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -36,11 +36,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option?> arrayEnum = default, Option?> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -113,6 +115,72 @@ public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value)
throw new NotImplementedException($"Value could not be handled: '{value}'");
}
+ ///
+ /// Defines ArrayEnumNullable
+ ///
+ public enum ArrayEnumNullableEnum
+ {
+ ///
+ /// Enum Fish for value: fish
+ ///
+ Fish = 1,
+
+ ///
+ /// Enum Crab for value: crab
+ ///
+ Crab = 2
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum ArrayEnumNullableEnumFromString(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ throw new NotImplementedException($"Could not convert value to type ArrayEnumNullableEnum: '{value}'");
+ }
+
+ ///
+ /// Returns a
+ ///
+ ///
+ ///
+ public static ArrayEnumNullableEnum? ArrayEnumNullableEnumFromStringOrDefault(string value)
+ {
+ if (value.Equals("fish"))
+ return ArrayEnumNullableEnum.Fish;
+
+ if (value.Equals("crab"))
+ return ArrayEnumNullableEnum.Crab;
+
+ return null;
+ }
+
+ ///
+ /// Converts the to the json value
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayEnumNullableEnumToJsonValue(ArrayEnumNullableEnum? value)
+ {
+ if (value == ArrayEnumNullableEnum.Fish)
+ return "fish";
+
+ if (value == ArrayEnumNullableEnum.Crab)
+ return "crab";
+
+ throw new NotImplementedException($"Value could not be handled: '{value}'");
+ }
+
///
/// Defines JustSymbol
///
@@ -205,6 +273,19 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value)
[JsonPropertyName("array_enum")]
public List? ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option?> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List? ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -220,6 +301,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -260,6 +342,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option?> arrayEnum = default;
+ Option?> arrayEnumNullable = default;
Option justSymbol = default;
while (utf8JsonReader.Read())
@@ -278,7 +361,38 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
switch (localVarJsonPropertyName)
{
case "array_enum":
- arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!);
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnum = new Option?>(null);
+ else
+ {
+ var arrayEnumItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumItemRawValue != null)
+ arrayEnumItems.Add(EnumArrays.ArrayEnumEnumFromStringOrDefault(arrayEnumItemRawValue));
+ }
+ arrayEnum = new Option?>(arrayEnumItems);
+ }
+ break;
+ case "array_enum_nullable":
+ if (utf8JsonReader.TokenType == JsonTokenType.Null)
+ arrayEnumNullable = new Option?>(null);
+ else
+ {
+ var arrayEnumNullableItems = new List();
+ while (utf8JsonReader.Read())
+ {
+ if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
+ break;
+ string? arrayEnumNullableItemRawValue = utf8JsonReader.GetString();
+ if (arrayEnumNullableItemRawValue != null)
+ arrayEnumNullableItems.Add(EnumArrays.ArrayEnumNullableEnumFromStringOrDefault(arrayEnumNullableItemRawValue));
+ }
+ arrayEnumNullable = new Option?>(arrayEnumNullableItems);
+ }
break;
case "just_symbol":
string? justSymbolRawValue = utf8JsonReader.GetString();
@@ -297,7 +411,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
if (justSymbol.IsSet && justSymbol.Value == null)
throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays.");
- return new EnumArrays(arrayEnum, justSymbol);
+ return new EnumArrays(arrayEnum, arrayEnumNullable, justSymbol);
}
///
@@ -330,8 +444,22 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe
if (enumArrays.ArrayEnumOption.IsSet)
{
writer.WritePropertyName("array_enum");
- JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var arrayEnumItem in enumArrays.ArrayEnum!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumEnumToJsonValue(arrayEnumItem));
+ writer.WriteEndArray();
}
+ if (enumArrays.ArrayEnumNullableOption.IsSet)
+ if (enumArrays.ArrayEnumNullableOption.Value != null)
+ {
+ writer.WritePropertyName("array_enum_nullable");
+ writer.WriteStartArray();
+ foreach (var arrayEnumNullableItem in enumArrays.ArrayEnumNullableOption.Value!)
+ writer.WriteStringValue(EnumArrays.ArrayEnumNullableEnumToJsonValue(arrayEnumNullableItem));
+ writer.WriteEndArray();
+ }
+ else
+ writer.WriteNull("array_enum_nullable");
var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value);
writer.WriteString("just_symbol", justSymbolRawValue);
}
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
index 63057540d6ae..9adf4649059e 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs
@@ -332,7 +332,10 @@ public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializ
if (mapTest.MapOfEnumStringOption.IsSet)
{
writer.WritePropertyName("map_of_enum_string");
- JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions);
+ writer.WriteStartArray();
+ foreach (var mapOfEnumStringItem in mapTest.MapOfEnumString!)
+ writer.WriteStringValue(MapTest.InnerEnumToJsonValue(mapOfEnumStringItem));
+ writer.WriteEndArray();
}
}
}
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 8e6e916f99eb..3e5095bfa2c4 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
@@ -1942,6 +1942,11 @@ components:
items:
$ref: "#/components/schemas/EnumArrays_array_enum_inner"
type: array
+ array_enum_nullable:
+ items:
+ $ref: "#/components/schemas/EnumArrays_array_enum_inner"
+ nullable: true
+ type: array
type: object
FreeFormObject:
additionalProperties: true
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md
index ae3e81632c1b..e56a9d351032 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
+**ArrayEnumNullable** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional]
**JustSymbol** | **EnumArraysJustSymbol** | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
index c6fee27690b7..9c80cb1b2e46 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs
@@ -62,6 +62,15 @@ public void ArrayEnumTest()
// TODO unit test for the property 'ArrayEnum'
}
+ ///
+ /// Test the property 'ArrayEnumNullable'
+ ///
+ [Fact]
+ public void ArrayEnumNullableTest()
+ {
+ // TODO unit test for the property 'ArrayEnumNullable'
+ }
+
///
/// Test the property 'JustSymbol'
///
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
index ef41971722d9..8fcd25fb727a 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs
@@ -33,11 +33,13 @@ public partial class EnumArrays : IValidatableObject
/// Initializes a new instance of the class.
///
/// arrayEnum
+ /// arrayEnumNullable
/// justSymbol
[JsonConstructor]
- public EnumArrays(Option> arrayEnum = default, Option justSymbol = default)
+ public EnumArrays(Option> arrayEnum = default, Option> arrayEnumNullable = default, Option justSymbol = default)
{
ArrayEnumOption = arrayEnum;
+ ArrayEnumNullableOption = arrayEnumNullable;
JustSymbolOption = justSymbol;
OnCreated();
}
@@ -70,6 +72,19 @@ public EnumArrays(Option> arrayEnum = default, Op
[JsonPropertyName("array_enum")]
public List ArrayEnum { get { return this.ArrayEnumOption.Value; } set { this.ArrayEnumOption = new(value); } }
+ ///
+ /// Used to track the state of ArrayEnumNullable
+ ///
+ [JsonIgnore]
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ public Option> ArrayEnumNullableOption { get; private set; }
+
+ ///
+ /// Gets or Sets ArrayEnumNullable
+ ///
+ [JsonPropertyName("array_enum_nullable")]
+ public List ArrayEnumNullable { get { return this.ArrayEnumNullableOption.Value; } set { this.ArrayEnumNullableOption = new(value); } }
+
///
/// Gets or Sets additional properties
///
@@ -85,6 +100,7 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class EnumArrays {\n");
sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n");
+ sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n");
sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
@@ -125,6 +141,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
Option> arrayEnum = default;
+ Option