From 2b7b258f7f7d600e61c2ee1c61bb6a501b3af66a Mon Sep 17 00:00:00 2001 From: Simon Schulte Date: Fri, 27 Mar 2026 11:17:42 +0100 Subject: [PATCH 1/6] fix(csharp): use enum rendering functions for array-of-enum properties in JSON converter Array-typed properties whose items are enums fell through to the generic JsonSerializer.Serialize/Deserialize path, which ignored the defined *ValueConverter.ToJsonValue/*FromStringOrDefault functions and serialized enum values using the default .NET JSON behaviour (PascalCase names). Add explicit {{#items.isEnum}} branches in both the read (Deserialize) and write (Serialize) paths of the generated JsonConverter so that each item in an enum array is processed via the same converter functions used for scalar enum properties. Co-Authored-By: Claude Sonnet 4.6 --- .../generichost/JsonConverter.mustache | 46 +++++++++++++++++ .../test/resources/3_0/csharp/enum-array.yaml | 51 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml 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 24810c9cee43..6c58c1f67b54 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,21 @@ {{^isNumeric}} {{^isDate}} {{^isDateTime}} + {{#items.isEnum}} + 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}} {{/isDateTime}} {{/isDate}} {{/isNumeric}} @@ -612,14 +626,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 +658,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 +674,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/enum-array.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml new file mode 100644 index 000000000000..26e5f6873504 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.0 +info: + title: Enum Array Test + description: >- + Tests that array-of-enum properties are serialized and deserialized using + the defined enum rendering functions rather than falling back to default + PascalCase JSON serialization. + version: 1.0.0 + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /shipments: + get: + operationId: GetShipments + tags: + - Shipments + responses: + '200': + description: Returns a list of shipments + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Shipment' +servers: + - url: 'http://localhost' +components: + schemas: + Shipment: + type: object + required: + - id + - allowedMethods + properties: + id: + type: integer + format: int32 + allowedMethods: + type: array + items: + $ref: '#/components/schemas/ShippingMethod' + preferredMethod: + $ref: '#/components/schemas/ShippingMethod' + ShippingMethod: + type: string + enum: + - standard + - express + - overnight From d0ba6160858aeff09afa8b57bd69c7fee6c50802 Mon Sep 17 00:00:00 2001 From: Simon Schulte Date: Fri, 27 Mar 2026 12:28:16 +0100 Subject: [PATCH 2/6] fix(csharp): guard array-of-enum deserialization against null JSON values Without the null check, a JSON null value for an array-of-enum property caused the reader to advance past the null token and attempt to read the next property as array content, desynchronizing the Utf8JsonReader. --- .../generichost/JsonConverter.mustache | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 6c58c1f67b54..813a58bd2316 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 @@ -252,16 +252,19 @@ {{^isDate}} {{^isDateTime}} {{#items.isEnum}} - 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.Null) { - 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}}); + 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); } - {{#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}}); From ba82277fe91c49112e1d4c38dcf7b2d8e4eded64 Mon Sep 17 00:00:00 2001 From: Simon Schulte Date: Tue, 7 Apr 2026 14:04:40 +0200 Subject: [PATCH 3/6] Apply recommended null-fix --- .../csharp/libraries/generichost/JsonConverter.mustache | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 813a58bd2316..e8f7fde2179e 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,8 +251,11 @@ {{^isNumeric}} {{^isDate}} {{^isDateTime}} + {{#isArray}} {{#items.isEnum}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()) @@ -269,6 +272,10 @@ {{^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}} From 66bc169d05e18143858ca9f9bf325834a1982f68 Mon Sep 17 00:00:00 2001 From: Simon Schulte Date: Tue, 7 Apr 2026 14:05:04 +0200 Subject: [PATCH 4/6] remove test-yml and extend petstore with single new property instead --- .../test/resources/3_0/csharp/enum-array.yaml | 51 ------------------- ...odels-for-testing-with-http-signature.yaml | 8 +++ 2 files changed, 8 insertions(+), 51 deletions(-) delete mode 100644 modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml deleted file mode 100644 index 26e5f6873504..000000000000 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/enum-array.yaml +++ /dev/null @@ -1,51 +0,0 @@ -openapi: 3.0.0 -info: - title: Enum Array Test - description: >- - Tests that array-of-enum properties are serialized and deserialized using - the defined enum rendering functions rather than falling back to default - PascalCase JSON serialization. - version: 1.0.0 - license: - name: Apache-2.0 - url: 'https://www.apache.org/licenses/LICENSE-2.0.html' -paths: - /shipments: - get: - operationId: GetShipments - tags: - - Shipments - responses: - '200': - description: Returns a list of shipments - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Shipment' -servers: - - url: 'http://localhost' -components: - schemas: - Shipment: - type: object - required: - - id - - allowedMethods - properties: - id: - type: integer - format: int32 - allowedMethods: - type: array - items: - $ref: '#/components/schemas/ShippingMethod' - preferredMethod: - $ref: '#/components/schemas/ShippingMethod' - ShippingMethod: - type: string - enum: - - standard - - express - - overnight 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 1c9e901ad0dd..f477f9443501 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 @@ -2039,6 +2039,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 From 1f323ee3de44b06d7d6a890438b0b20480a8aa6f Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 7 Jun 2026 11:50:36 +0800 Subject: [PATCH 5/6] update C# samples --- .../latest/UseDateTimeOffset/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net10/FormModels/api/openapi.yaml | 5 + .../FormModels/docs/models/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 32 ++++- .../net10/NullReferenceTypes/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net10/Petstore/api/openapi.yaml | 8 ++ .../net10/Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net10/SourceGeneration/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net4.7/FormModels/api/openapi.yaml | 5 + .../FormModels/docs/models/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 32 ++++- .../net4.7/Petstore/api/openapi.yaml | 8 ++ .../net4.7/Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net4.8/FormModels/api/openapi.yaml | 5 + .../FormModels/docs/models/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 32 ++++- .../net4.8/Petstore/api/openapi.yaml | 8 ++ .../net4.8/Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net8/FormModels/api/openapi.yaml | 5 + .../net8/FormModels/docs/models/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 32 ++++- .../net8/NullReferenceTypes/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net8/Petstore/api/openapi.yaml | 8 ++ .../net8/Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net8/SourceGeneration/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net9/FormModels/api/openapi.yaml | 5 + .../net9/FormModels/docs/models/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 32 ++++- .../net9/NullReferenceTypes/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net9/Petstore/api/openapi.yaml | 8 ++ .../net9/Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net9/SourceGeneration/api/openapi.yaml | 8 ++ .../docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../standard2.0/Petstore/api/openapi.yaml | 8 ++ .../Petstore/docs/models/EnumArrays.md | 1 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 136 +++++++++++++++++- .../src/Org.OpenAPITools/Model/MapTest.cs | 5 +- .../net10/Petstore/api/openapi.yaml | 8 ++ .../net10/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 34 ++++- .../httpclient/net9/Petstore/api/openapi.yaml | 8 ++ .../net9/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 34 ++++- .../standard2.0/Petstore/api/openapi.yaml | 8 ++ .../standard2.0/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 34 ++++- .../restsharp/net8/Petstore/api/openapi.yaml | 8 ++ .../net8/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 34 ++++- .../ConditionalSerialization/api/openapi.yaml | 8 ++ .../docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 56 +++++++- .../net10/Petstore/api/openapi.yaml | 8 ++ .../net10/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 40 +++++- .../net9/Petstore/api/openapi.yaml | 8 ++ .../net9/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 40 +++++- .../standard2.0/Petstore/api/openapi.yaml | 8 ++ .../standard2.0/Petstore/docs/EnumArrays.md | 1 + .../src/Org.OpenAPITools/Model/EnumArrays.cs | 40 +++++- 104 files changed, 2467 insertions(+), 83 deletions(-) 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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> 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/net9/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/NullReferenceTypes/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumArrays.md index 7467f67978c5..70c96be2c716 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumArrays.md +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs index f442dd44bfa2..b3b25b83f8a5 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -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/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index f2e96952c4bb..6f9a624aec8e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs index e9ed8d747187..473b76ca035f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumArrays.md index 7467f67978c5..70c96be2c716 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumArrays.md +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 9ea7d8118c3b..20ceb86959aa 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -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/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 43b688de6dd5..a90c1304bd40 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 7ba0cf8f07b4..f85d31b54962 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/SourceGeneration/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumArrays.md index 7467f67978c5..70c96be2c716 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumArrays.md +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs index f442dd44bfa2..b3b25b83f8a5 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -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/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index 4a8e487309f0..a4f2141612ba 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs index 63057540d6ae..9adf4649059e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml @@ -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/standard2.0/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/EnumArrays.md index 7467f67978c5..70c96be2c716 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/models/EnumArrays.md +++ b/samples/client/petstore/csharp/generichost/standard2.0/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/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 92d95ba94060..118e592aee62 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -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/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index e285c7523d4c..eab30860a496 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/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/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 6f322da6a9bf..3b2a67cfac2a 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/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/httpclient/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/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/httpclient/net10/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/httpclient/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 8c561798337a..5e008f3acd10 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -77,15 +77,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; this.AdditionalProperties = new Dictionary(); } @@ -95,6 +116,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Gets or Sets additional properties /// @@ -111,6 +138,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -159,6 +187,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/net9/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/httpclient/net9/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/httpclient/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 8c561798337a..5e008f3acd10 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -77,15 +77,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; this.AdditionalProperties = new Dictionary(); } @@ -95,6 +116,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Gets or Sets additional properties /// @@ -111,6 +138,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -159,6 +187,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/standard2.0/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/httpclient/standard2.0/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 8c561798337a..5e008f3acd10 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -77,15 +77,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; this.AdditionalProperties = new Dictionary(); } @@ -95,6 +116,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Gets or Sets additional properties /// @@ -111,6 +138,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -159,6 +187,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/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/restsharp/net8/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 7dd8b1c9e01b..8ee60c64e11e 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -76,15 +76,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; } /// @@ -93,6 +114,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Returns the string presentation of the object /// @@ -103,6 +130,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -150,6 +178,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } return hashCode; } } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/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/restsharp/standard2.0/ConditionalSerialization/docs/EnumArrays.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Model/EnumArrays.cs index 774f416dcaec..859a88711d90 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -96,12 +96,32 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this._JustSymbol = justSymbol; if (this.JustSymbol != null) @@ -113,6 +133,11 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra { this._flagArrayEnum = true; } + this._ArrayEnumNullable = arrayEnumNullable; + if (this.ArrayEnumNullable != null) + { + this._flagArrayEnumNullable = true; + } this.AdditionalProperties = new Dictionary(); } @@ -141,6 +166,30 @@ public bool ShouldSerializeArrayEnum() return _flagArrayEnum; } /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable + { + get{ return _ArrayEnumNullable;} + set + { + _ArrayEnumNullable = value; + _flagArrayEnumNullable = true; + } + } + private List _ArrayEnumNullable; + private bool _flagArrayEnumNullable; + + /// + /// Returns false as ArrayEnumNullable should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeArrayEnumNullable() + { + return _flagArrayEnumNullable; + } + /// /// Gets or Sets additional properties /// [JsonExtensionData] @@ -156,6 +205,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -204,6 +254,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/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/unityWebRequest/net10/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index eed838f3a0ed..e93de069314f 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -74,15 +74,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; } /// @@ -91,6 +112,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Returns the string presentation of the object /// @@ -101,6 +128,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -145,6 +173,12 @@ public bool Equals(EnumArrays input) this.ArrayEnum != null && input.ArrayEnum != null && this.ArrayEnum.SequenceEqual(input.ArrayEnum) + ) && + ( + this.ArrayEnumNullable == input.ArrayEnumNullable || + this.ArrayEnumNullable != null && + input.ArrayEnumNullable != null && + this.ArrayEnumNullable.SequenceEqual(input.ArrayEnumNullable) ); } @@ -162,6 +196,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } return hashCode; } } diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/net9/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/unityWebRequest/net9/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index eed838f3a0ed..e93de069314f 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -74,15 +74,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; } /// @@ -91,6 +112,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Returns the string presentation of the object /// @@ -101,6 +128,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -145,6 +173,12 @@ public bool Equals(EnumArrays input) this.ArrayEnum != null && input.ArrayEnum != null && this.ArrayEnum.SequenceEqual(input.ArrayEnum) + ) && + ( + this.ArrayEnumNullable == input.ArrayEnumNullable || + this.ArrayEnumNullable != null && + input.ArrayEnumNullable != null && + this.ArrayEnumNullable.SequenceEqual(input.ArrayEnumNullable) ); } @@ -162,6 +196,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } return hashCode; } } diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml index a179b6cfdd29..a33bcf6b30b4 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/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/unityWebRequest/standard2.0/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/EnumArrays.md index 62e34f03dbc3..e53e11164f20 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/EnumArrays.md +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/EnumArrays.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] **ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**ArrayEnumNullable** | **List<EnumArrays.ArrayEnumNullableEnum>** | | [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/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index eed838f3a0ed..e93de069314f 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -74,15 +74,36 @@ public enum ArrayEnumEnum Crab = 2 } + /// + /// Defines ArrayEnumNullable + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ArrayEnumNullableEnum + { + /// + /// Enum Fish for value: fish + /// + [EnumMember(Value = "fish")] + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + [EnumMember(Value = "crab")] + Crab = 2 + } + /// /// Initializes a new instance of the class. /// /// justSymbol. /// arrayEnum. - public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default) + /// arrayEnumNullable. + public EnumArrays(JustSymbolEnum? justSymbol = default, List arrayEnum = default, List arrayEnumNullable = default) { this.JustSymbol = justSymbol; this.ArrayEnum = arrayEnum; + this.ArrayEnumNullable = arrayEnumNullable; } /// @@ -91,6 +112,12 @@ public EnumArrays(JustSymbolEnum? justSymbol = default, List arra [DataMember(Name = "array_enum", EmitDefaultValue = false)] public List ArrayEnum { get; set; } + /// + /// Gets or Sets ArrayEnumNullable + /// + [DataMember(Name = "array_enum_nullable", EmitDefaultValue = true)] + public List ArrayEnumNullable { get; set; } + /// /// Returns the string presentation of the object /// @@ -101,6 +128,7 @@ public override string ToString() sb.Append("class EnumArrays {\n"); sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" ArrayEnumNullable: ").Append(ArrayEnumNullable).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -145,6 +173,12 @@ public bool Equals(EnumArrays input) this.ArrayEnum != null && input.ArrayEnum != null && this.ArrayEnum.SequenceEqual(input.ArrayEnum) + ) && + ( + this.ArrayEnumNullable == input.ArrayEnumNullable || + this.ArrayEnumNullable != null && + input.ArrayEnumNullable != null && + this.ArrayEnumNullable.SequenceEqual(input.ArrayEnumNullable) ); } @@ -162,6 +196,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.ArrayEnum.GetHashCode(); } + if (this.ArrayEnumNullable != null) + { + hashCode = (hashCode * 59) + this.ArrayEnumNullable.GetHashCode(); + } return hashCode; } } From 533263897e5fb7217ca7598eedbe0e5921c57933 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 7 Jun 2026 15:01:46 +0800 Subject: [PATCH 6/6] regenerate C# samples --- .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ .../src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs | 9 +++++++++ 18 files changed, 162 insertions(+) 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/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/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/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/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/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/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.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/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/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/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/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/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/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/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index c6fee27690b7..9c80cb1b2e46 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index c6fee27690b7..9c80cb1b2e46 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index c6fee27690b7..9c80cb1b2e46 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/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/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index c6fee27690b7..9c80cb1b2e46 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/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' ///