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 0ff2753e33a3..2328f9ce1f29 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 @@ -185,33 +185,27 @@ {{/isMap}} {{/isString}} {{#isBoolean}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.GetBoolean()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); {{/isBoolean}} {{#isNumeric}} {{^isEnum}} {{#isDouble}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.GetDouble()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); {{/isDouble}} {{#isDecimal}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.GetDecimal()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); {{/isDecimal}} {{#isFloat}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}(float)utf8JsonReader.GetDouble()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); {{/isFloat}} {{#isLong}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? ({{#vendorExtensions.x-unsigned}}u{{/vendorExtensions.x-unsigned}}long?)null : utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64()); {{/isLong}} {{^isLong}} {{^isFloat}} {{^isDecimal}} {{^isDouble}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? ({{#vendorExtensions.x-unsigned}}u{{/vendorExtensions.x-unsigned}}int?)null : utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); {{/isDouble}} {{/isDecimal}} {{/isFloat}} @@ -219,18 +213,15 @@ {{/isEnum}} {{/isNumeric}} {{#isDate}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{#supportsDateOnly}}DateOnly{{/supportsDateOnly}}{{^supportsDateOnly}}DateTime{{/supportsDateOnly}}{{#isNullable}}?{{/isNullable}}>(ref utf8JsonReader, jsonSerializerOptions)); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{#supportsDateOnly}}DateOnly{{/supportsDateOnly}}{{^supportsDateOnly}}DateTime{{/supportsDateOnly}}{{#isNullable}}?{{/isNullable}}>(ref utf8JsonReader, jsonSerializerOptions)); {{/isDate}} {{#isDateTime}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); {{/isDateTime}} {{#isEnum}} {{^isMap}} {{#isNumeric}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? ({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}?)null : ({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); {{/isNumeric}} {{^isNumeric}} string{{nrt?}} {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}RawValue = utf8JsonReader.GetString(); @@ -246,8 +237,7 @@ {{/isMap}} {{/isEnum}} {{#isUuid}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.GetGuid()); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); {{/isUuid}} {{^isUuid}} {{^isEnum}} @@ -256,8 +246,7 @@ {{^isNumeric}} {{^isDate}} {{^isDateTime}} - if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^isNullable}}{{nrt!}}{{/isNullable}}); + {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^isNullable}}{{nrt!}}{{/isNullable}}); {{/isDateTime}} {{/isDate}} {{/isNumeric}} diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 30d6ca1fc47a..f25596215be6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -115,8 +115,7 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "children": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + children = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs index 8eaaa8256eec..c6f78d43c423 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -132,8 +132,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "age": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = new Option(utf8JsonReader.GetInt32()); + age = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()); @@ -145,8 +144,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert type = new Option(utf8JsonReader.GetString()); break; case "boosterSeat": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = new Option(utf8JsonReader.GetBoolean()); + boosterSeat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index 15899a012afd..edf36db227d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index bdb8dcaba25b..2cf5830c69f6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -125,8 +125,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs index a5e4bd35e9bc..4562d4ceb728 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index d7b4374e6a7b..db832150ed96 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ec17222fbc8f..f70c7a4c5fc3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 77ec0bd5ed2d..74dbae3c6ba3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 1cc72ecd59d3..1a839ecb01b6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d2398a452eee..cea3f5a4ba50 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cce8d5d564b6..47bac6ba97c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 3fbc72e2f5ab..1992bf9e932d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs index d92ba4ae6aef..d7b7e8188f75 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index c9734cbe3808..8aa8da44caea 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 780c28a972a6..9ed61c34f667 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs index f483d87f36c8..7db5ba3129ff 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1c478cf336df..62ae935e4564 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index a853b96144e2..e83b95303760 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 6520bebabc0f..007eba77a358 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 @@ -143,8 +143,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f9d9d9f7a7b8..76db6338890f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c7d043666115..285e193a7e15 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 86d63c7ac5f6..a4410d55b34a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index 120a8fb0dd54..7331b5d3f61b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -177,20 +177,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index c81de3d2f67d..3a559f831196 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index 32515bc04405..5e238e0f7b30 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cef3330300e..e0462d7c8a25 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index bf37307ad965..882bf7ccda47 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs index b322aaf568ce..dba5779e547d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 42533f9c7ebf..397f12bffbb0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 286d13258dce..6efbeef44dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 29f5a80e6462..55ab016ac3db 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 83f513bc63bb..541a621953aa 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs index 3dbb629ecf99..8af5defaed7e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -217,24 +217,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 92ec1939d1af..d366c24ec24c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs index e4049df78c03..6e741c362d66 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -201,16 +201,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -218,8 +215,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(PetStatusValueConverter.FromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 4eb4f6acc58d..f7422f86f558 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -747,20 +747,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": string requiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -786,40 +782,31 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": string notrequiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -845,20 +832,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": string notrequiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -884,24 +867,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": string requiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -919,8 +897,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -931,8 +908,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs index 4b0b889b708e..fb1b3546a031 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs index 6a2c4c85eb4a..81211e0ce4ac 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 46625cb093a3..5b7a88bd659a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7ec3c110c2a1..f30e2a11997b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 4290e8270ff9..6b9d5082405b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 04d04337aa4a..7328caf1ead5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 4d237900519a..cfa1aee10f8d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs index e89d58457324..a85e556bb9e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 834e6957c675..56da6f6db3c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs index 15899a012afd..edf36db227d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs index a5e4bd35e9bc..4562d4ceb728 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index d7b4374e6a7b..db832150ed96 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ec17222fbc8f..f70c7a4c5fc3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 77ec0bd5ed2d..74dbae3c6ba3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1cc72ecd59d3..1a839ecb01b6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d2398a452eee..cea3f5a4ba50 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cce8d5d564b6..47bac6ba97c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 3fbc72e2f5ab..1992bf9e932d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs index d92ba4ae6aef..d7b7e8188f75 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index c9734cbe3808..8aa8da44caea 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 780c28a972a6..9ed61c34f667 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs index f483d87f36c8..7db5ba3129ff 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1c478cf336df..62ae935e4564 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index a853b96144e2..e83b95303760 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 b6716a58e539..c107741e961d 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 @@ -275,8 +275,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 08e961298725..40d5e2753631 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -744,16 +744,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f9d9d9f7a7b8..76db6338890f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c7d043666115..285e193a7e15 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 86d63c7ac5f6..a4410d55b34a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 97588d56888a..0af46ec34e41 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 @@ -243,20 +243,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index c81de3d2f67d..3a559f831196 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index 32515bc04405..5e238e0f7b30 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cef3330300e..e0462d7c8a25 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index bf37307ad965..882bf7ccda47 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs index b322aaf568ce..dba5779e547d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 42533f9c7ebf..397f12bffbb0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 286d13258dce..6efbeef44dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 29f5a80e6462..55ab016ac3db 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 83f513bc63bb..541a621953aa 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs index 580ef432ecf1..ad31eb6ad143 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -299,24 +299,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 92ec1939d1af..d366c24ec24c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 81d80e33de70..e8e661445a1c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -283,16 +283,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -300,8 +297,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 0990c0ab7a40..fee9ba7f2965 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1825,28 +1825,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1862,48 +1856,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1919,28 +1902,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1956,32 +1933,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1989,8 +1959,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2001,8 +1970,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs index 4b0b889b708e..fb1b3546a031 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs index 6a2c4c85eb4a..81211e0ce4ac 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 46625cb093a3..5b7a88bd659a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7ec3c110c2a1..f30e2a11997b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 4290e8270ff9..6b9d5082405b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 04d04337aa4a..7328caf1ead5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 4d237900519a..cfa1aee10f8d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs index e89d58457324..a85e556bb9e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 834e6957c675..56da6f6db3c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index 504c2976b3f4..1858ede45ba0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -145,12 +145,10 @@ public override NowGet200Response Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "now": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "today": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 30d6ca1fc47a..f25596215be6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -115,8 +115,7 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "children": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + children = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs index 8eaaa8256eec..c6f78d43c423 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -132,8 +132,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "age": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = new Option(utf8JsonReader.GetInt32()); + age = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()); @@ -145,8 +144,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert type = new Option(utf8JsonReader.GetString()); break; case "boosterSeat": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = new Option(utf8JsonReader.GetBoolean()); + boosterSeat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index 15899a012afd..edf36db227d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index bdb8dcaba25b..2cf5830c69f6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -125,8 +125,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs index a5e4bd35e9bc..4562d4ceb728 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index d7b4374e6a7b..db832150ed96 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ec17222fbc8f..f70c7a4c5fc3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 77ec0bd5ed2d..74dbae3c6ba3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 1cc72ecd59d3..1a839ecb01b6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d2398a452eee..cea3f5a4ba50 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cce8d5d564b6..47bac6ba97c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 3fbc72e2f5ab..1992bf9e932d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs index d92ba4ae6aef..d7b7e8188f75 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index c9734cbe3808..8aa8da44caea 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 780c28a972a6..9ed61c34f667 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs index f483d87f36c8..7db5ba3129ff 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1c478cf336df..62ae935e4564 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index a853b96144e2..e83b95303760 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 6520bebabc0f..007eba77a358 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 @@ -143,8 +143,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f9d9d9f7a7b8..76db6338890f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c7d043666115..285e193a7e15 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 86d63c7ac5f6..a4410d55b34a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index 120a8fb0dd54..7331b5d3f61b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -177,20 +177,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index c81de3d2f67d..3a559f831196 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index 32515bc04405..5e238e0f7b30 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cef3330300e..e0462d7c8a25 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index bf37307ad965..882bf7ccda47 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs index b322aaf568ce..dba5779e547d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 42533f9c7ebf..397f12bffbb0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 286d13258dce..6efbeef44dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 29f5a80e6462..55ab016ac3db 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 83f513bc63bb..541a621953aa 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs index 3dbb629ecf99..8af5defaed7e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -217,24 +217,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 92ec1939d1af..d366c24ec24c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index e4049df78c03..6e741c362d66 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -201,16 +201,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -218,8 +215,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(PetStatusValueConverter.FromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 4eb4f6acc58d..f7422f86f558 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -747,20 +747,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": string requiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -786,40 +782,31 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": string notrequiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -845,20 +832,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": string notrequiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -884,24 +867,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": string requiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -919,8 +897,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -931,8 +908,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs index 4b0b889b708e..fb1b3546a031 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs index 6a2c4c85eb4a..81211e0ce4ac 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 46625cb093a3..5b7a88bd659a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7ec3c110c2a1..f30e2a11997b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 4290e8270ff9..6b9d5082405b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 04d04337aa4a..7328caf1ead5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 4d237900519a..cfa1aee10f8d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs index e89d58457324..a85e556bb9e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 834e6957c675..56da6f6db3c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs index 15899a012afd..edf36db227d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs index a5e4bd35e9bc..4562d4ceb728 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index d7b4374e6a7b..db832150ed96 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ec17222fbc8f..f70c7a4c5fc3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 77ec0bd5ed2d..74dbae3c6ba3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1cc72ecd59d3..1a839ecb01b6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d2398a452eee..cea3f5a4ba50 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cce8d5d564b6..47bac6ba97c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 3fbc72e2f5ab..1992bf9e932d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs index d92ba4ae6aef..d7b7e8188f75 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index c9734cbe3808..8aa8da44caea 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 780c28a972a6..9ed61c34f667 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs index f483d87f36c8..7db5ba3129ff 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1c478cf336df..62ae935e4564 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index a853b96144e2..e83b95303760 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 b6716a58e539..c107741e961d 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 @@ -275,8 +275,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 08e961298725..40d5e2753631 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -744,16 +744,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f9d9d9f7a7b8..76db6338890f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c7d043666115..285e193a7e15 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 86d63c7ac5f6..a4410d55b34a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 97588d56888a..0af46ec34e41 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 @@ -243,20 +243,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index c81de3d2f67d..3a559f831196 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index 32515bc04405..5e238e0f7b30 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cef3330300e..e0462d7c8a25 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index bf37307ad965..882bf7ccda47 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs index b322aaf568ce..dba5779e547d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 42533f9c7ebf..397f12bffbb0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 286d13258dce..6efbeef44dcd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 29f5a80e6462..55ab016ac3db 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 83f513bc63bb..541a621953aa 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs index 580ef432ecf1..ad31eb6ad143 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -299,24 +299,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 92ec1939d1af..d366c24ec24c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 81d80e33de70..e8e661445a1c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -283,16 +283,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -300,8 +297,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 0990c0ab7a40..fee9ba7f2965 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1825,28 +1825,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1862,48 +1856,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1919,28 +1902,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1956,32 +1933,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1989,8 +1959,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2001,8 +1970,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs index 4b0b889b708e..fb1b3546a031 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs index 6a2c4c85eb4a..81211e0ce4ac 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 46625cb093a3..5b7a88bd659a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7ec3c110c2a1..f30e2a11997b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 4290e8270ff9..6b9d5082405b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 04d04337aa4a..7328caf1ead5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 4d237900519a..cfa1aee10f8d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs index e89d58457324..a85e556bb9e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 834e6957c675..56da6f6db3c6 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index 504c2976b3f4..1858ede45ba0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -145,12 +145,10 @@ public override NowGet200Response Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "now": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "today": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 88a0bc9e8ae8..e5c016d2627d 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -117,8 +117,7 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "children": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs index b174729f4700..25e989718a63 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -134,8 +134,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "age": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = new Option(utf8JsonReader.GetInt32()); + age = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()!); @@ -147,8 +146,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert type = new Option(utf8JsonReader.GetString()!); break; case "boosterSeat": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = new Option(utf8JsonReader.GetBoolean()); + boosterSeat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index 66a33723aebc..170ad4b54dac 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index 36e0ac854e6d..93897bf0b56a 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -127,8 +127,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs index f9d2680b0ad5..aabac63ce195 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index f5bcaf712030..1da19734a2d3 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 8d4153d53022..5fa49b8033da 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 3b185247e442..78ce72e42861 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 942640761b26..f9d8cb0178a6 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index debcff217b93..6bd3d13aec0c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ded293438a45..c1fc28e5e87e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index ee7b94f08bd3..24f40349480e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 476a1c25352b..e0176c9c103d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index a3a0a15428b4..dd211ecc28ae 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index f424f8ef9d85..6b4b1efcac37 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs index 9bd387646078..406cff32fdf5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1f3a3bb8a98e..921b10388991 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index 72e59c9baf44..50db62858883 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 516c952c2071..afdb3342ce23 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 @@ -143,8 +143,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b4307b69a3b6..601c8e998661 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 1540483527a3..db1b090fa3e9 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 96902abd13a6..7c9c96b05c0d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index 101cfb09d2ae..d2f562dc62c7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -177,20 +177,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 674358380306..88c96f83b3a1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2467daa6e2b3..6049305ccc01 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 808a4b66c6f2..2b9dab1b761b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index 8e865d8efae7..d74cab9a645c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs index db407f5e3553..1ced7be525f5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 3b9f00ed6666..47b7b40607a7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 5f369537bb2a..bbc9459f436f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index f720208fafe0..55e6045dc21e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 50ad5aef5a1b..dc0e8da10833 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs index c9c24d32fc40..0f70b6ee763d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -217,24 +217,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 5a072449fae0..abcca493d7d2 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 6b354389b24a..294770c56dfb 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -201,16 +201,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -218,8 +215,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(PetStatusValueConverter.FromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 6465301de4d0..8a2fc39d76bf 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -747,20 +747,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": string requiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -786,40 +782,31 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": string notrequiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -845,20 +832,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": string notrequiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -884,24 +867,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": string requiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -919,8 +897,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -931,8 +908,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs index 4012eec09fb6..d29f16225c9a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs index 9d1fbcfd0f6f..fcf8e483d79e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 749507fe8e0c..b9a4a5f9c95c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 08b9d580d9f1..25d27479cb9b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index d5fb2f5610ad..3ebb619596ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 1936341f8ba6..54cbe89d95af 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 46ccc750b1c2..508d19f2807e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs index 0c2e096925ef..62f5b0736d68 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index a445c5ac182b..012c650e4f1c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs index 87bc3578658c..fd37515f54a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -128,8 +128,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 546931023bb4..80ab5ec04b8d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -148,8 +148,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 20b8444349b0..de2cf7f84849 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -248,36 +248,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index cd20dcc6f2a2..c7fa501c3c5d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -162,8 +162,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index e4d0962e9ef4..fdef147cb388 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -134,8 +134,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 9b23c0166650..a09872cef811 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -128,8 +128,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cfe30e6ce660..c338f29efc9d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -128,8 +128,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs index 0899aecaee69..04609b245365 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -162,16 +162,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs index 308d4078b7f3..cf0ee9cdb1aa 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs index 46e11565b533..10375771f80b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -131,12 +131,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index 0a879915fc74..4887c6c7aff7 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -121,8 +121,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()!); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 96854b6b0e4f..936d8dc8b225 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -138,8 +138,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs index a84805aa8011..d908fed19a3a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -134,8 +134,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs index 837b5ef56bf3..1668434a783f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -179,20 +179,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; 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 83efec82813d..9a6f097e92c2 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 @@ -277,8 +277,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs index 204a7a95d7e3..ea7a5bd26988 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -746,16 +746,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 7b9bfd4fbeb6..971a81e9c8c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -145,12 +145,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 3c5e2512bb04..f4e54444c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -128,8 +128,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index 5244065820ea..5564d0d38435 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -667,71 +667,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()!); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()!); @@ -746,16 +730,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 bba52b3ffbce..06668cf78934 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 @@ -245,20 +245,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs index ac4b562eb3e7..266cbf7f9d2e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -128,8 +128,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs index 7a8da4dbed10..4d5b2c6d94cf 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -128,8 +128,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 17ee15eb2f4d..968a64762901 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -191,20 +191,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index bb28841a9e57..76bffb1856bc 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -148,8 +148,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()!); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index fb877759c605..100ccfa20e5b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -213,19 +213,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index f7e59fb345ac..fdf9064400f4 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -131,12 +131,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs index 91695a8649d6..db7eaa8f675c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -325,48 +325,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 83619d031144..47db90bf3525 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -129,8 +129,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs index b52b1cc177f1..f7ae912c05e6 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -128,8 +128,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index ec6905ea3a72..fa4f88b3ecdd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -182,16 +182,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs index a3e3679fe3dc..c4c43309bec1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -301,24 +301,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index 01d4f3844ebf..4428479e0485 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -162,12 +162,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index 55df1e0579f5..56b981a0e2ad 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -285,16 +285,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()!); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); @@ -302,8 +299,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index 15688d958f05..0c7dc7eab56f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1827,28 +1827,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1864,48 +1858,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1921,28 +1904,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1958,32 +1935,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1991,8 +1961,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2003,8 +1972,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs index 4a1e1fc3b490..6119748b2992 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs @@ -168,8 +168,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()!); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index 0d9fe3516e6f..6276a3a8c8ae 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -171,8 +171,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d520cfcc9a96..245ea1053e5d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -145,12 +145,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index d66e2a9e7328..1fce10cd7823 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -148,8 +148,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index 92de05e2d752..a6c404c940b8 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -145,8 +145,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index ed3d3f74081b..5cbf9d28f57e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -128,8 +128,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 3cd60d602954..e7829b5974ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -169,8 +169,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 7b55e2baf5bc..d02f765752fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -320,12 +320,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()!); @@ -334,19 +332,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()!); @@ -355,8 +350,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index a655c0d30e99..3d5ad4a7d676 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -158,12 +158,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs index 66a33723aebc..170ad4b54dac 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs index f9d2680b0ad5..aabac63ce195 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index f5bcaf712030..1da19734a2d3 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 8d4153d53022..5fa49b8033da 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 3b185247e442..78ce72e42861 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 942640761b26..f9d8cb0178a6 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index debcff217b93..6bd3d13aec0c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ded293438a45..c1fc28e5e87e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index ee7b94f08bd3..24f40349480e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 476a1c25352b..e0176c9c103d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index a3a0a15428b4..dd211ecc28ae 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index f424f8ef9d85..6b4b1efcac37 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs index 9bd387646078..406cff32fdf5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1f3a3bb8a98e..921b10388991 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index 72e59c9baf44..50db62858883 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 4eb9365b1f54..2a7d6a8a5f4d 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 @@ -275,8 +275,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index f7a3a20b1b10..b44f96171f59 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -744,16 +744,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b4307b69a3b6..601c8e998661 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 1540483527a3..db1b090fa3e9 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 96902abd13a6..7c9c96b05c0d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 938d01fec443..796232e12c55 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 @@ -243,20 +243,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 674358380306..88c96f83b3a1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2467daa6e2b3..6049305ccc01 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 808a4b66c6f2..2b9dab1b761b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index 8e865d8efae7..d74cab9a645c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs index db407f5e3553..1ced7be525f5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 3b9f00ed6666..47b7b40607a7 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 5f369537bb2a..bbc9459f436f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index f720208fafe0..55e6045dc21e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 50ad5aef5a1b..dc0e8da10833 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs index ee5777aabe75..094096b6350d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -299,24 +299,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 5a072449fae0..abcca493d7d2 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 8e7b548b39fd..7e8a3d34957a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -283,16 +283,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -300,8 +297,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index f1483ce99399..6217ae6e6799 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1825,28 +1825,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1862,48 +1856,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1919,28 +1902,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1956,32 +1933,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1989,8 +1959,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2001,8 +1970,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs index 4012eec09fb6..d29f16225c9a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs index 9d1fbcfd0f6f..fcf8e483d79e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 749507fe8e0c..b9a4a5f9c95c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 08b9d580d9f1..25d27479cb9b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index d5fb2f5610ad..3ebb619596ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 1936341f8ba6..54cbe89d95af 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 46ccc750b1c2..508d19f2807e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs index 0c2e096925ef..62f5b0736d68 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index a445c5ac182b..012c650e4f1c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs index 97aaf78dd30a..65645b2e4829 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -129,8 +129,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 993b2a750ce7..728bbb0c349e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -149,8 +149,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index fe4e050f537d..9fa35476f70c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -249,36 +249,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index 4ae5d07dcfef..bf92565f9a2e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -163,8 +163,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 840e615e2280..cbb5ea8f0849 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -135,8 +135,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d27c45fdcd1d..cd3309a5900e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -129,8 +129,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 72dc6b5327f5..90b6e4a8bd14 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -129,8 +129,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs index 947e074e1390..6be410aad46e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -163,16 +163,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs index 06208194730c..1352e54c4091 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -129,8 +129,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs index c145e62672fb..584505890fdc 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -132,12 +132,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 33e8935a249e..00b32d995aa3 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -122,8 +122,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()!); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 286d8b6464b5..0369f8f37e97 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -139,8 +139,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs index dfa0a603bb61..8981331c9e19 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -135,8 +135,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs index 1f8cc5462321..b6400a09e802 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -180,20 +180,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; 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 809acadd5224..5c9774abc417 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 @@ -278,8 +278,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs index 65adf54ea349..897a9bd24efe 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -747,16 +747,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d713d6a161ee..d7c977f2fe4f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -146,12 +146,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index d1d691a8dd2e..9f57f4d6318a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -129,8 +129,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index d9011f3dbd67..57b32c67f7b3 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -668,71 +668,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()!); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()!); @@ -747,16 +731,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 cf14472204d4..40dee3f15569 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 @@ -246,20 +246,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs index cb6c05a7c77f..cdac03c3bcf4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -129,8 +129,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2f8ac2dc1d53..e9f36662dd80 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -129,8 +129,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index a9e28c2f3e83..3629d644571b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -192,20 +192,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index a6022a5f9cce..4b3f421263d4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -149,8 +149,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()!); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index 2632fefd0fac..72938274943d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -214,19 +214,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index e3a042f07ea2..212b80559b9f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -132,12 +132,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs index 97697787aa33..aa2baca6ee31 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -326,48 +326,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 7db4f508852b..d0c107c1a216 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -130,8 +130,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs index b33930dee1b7..3662647e6562 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -129,8 +129,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 72d8feb0ba05..b2fced877576 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -183,16 +183,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs index ad8a7fe42d07..fff55dc03b4b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -302,24 +302,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 9e354ba31085..834a7f3516f1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -163,12 +163,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index f055e78da6e8..fc68eb27a177 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -286,16 +286,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()!); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); @@ -303,8 +300,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index f8095975d33e..074d0e77ee37 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1828,28 +1828,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1865,48 +1859,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1922,28 +1905,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1959,32 +1936,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1992,8 +1962,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2004,8 +1973,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs index 73b136378454..1c1f18fd1dec 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs @@ -169,8 +169,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()!); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index 14b4548c6105..1544a23710c1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -172,8 +172,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 8df9de9ae715..28b65b24ecf3 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -146,12 +146,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index c72f3539283b..0cf9332983fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -149,8 +149,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index 9ac29533f720..a350814f2c88 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -146,8 +146,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index bfc3a14472d7..37acae1c88df 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -129,8 +129,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index ccb64f191628..df0deacac70e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -170,8 +170,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index 6692b4f25093..6af3ab9df35c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -321,12 +321,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()!); @@ -335,19 +333,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()!); @@ -356,8 +351,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index f3f3e60766df..080a4f804022 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -159,12 +159,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index d07559ec5275..d81a3689e6e1 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -147,12 +147,10 @@ public override NowGet200Response Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "now": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "today": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 88a0bc9e8ae8..e5c016d2627d 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -117,8 +117,7 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "children": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs index b174729f4700..25e989718a63 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -134,8 +134,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "age": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = new Option(utf8JsonReader.GetInt32()); + age = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "firstName": firstName = new Option(utf8JsonReader.GetString()!); @@ -147,8 +146,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert type = new Option(utf8JsonReader.GetString()!); break; case "boosterSeat": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = new Option(utf8JsonReader.GetBoolean()); + boosterSeat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index 66a33723aebc..170ad4b54dac 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index 36e0ac854e6d..93897bf0b56a 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -127,8 +127,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs index f9d2680b0ad5..aabac63ce195 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index f5bcaf712030..1da19734a2d3 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 8d4153d53022..5fa49b8033da 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 3b185247e442..78ce72e42861 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 942640761b26..f9d8cb0178a6 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index debcff217b93..6bd3d13aec0c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ded293438a45..c1fc28e5e87e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index ee7b94f08bd3..24f40349480e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 476a1c25352b..e0176c9c103d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index a3a0a15428b4..dd211ecc28ae 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs index f424f8ef9d85..6b4b1efcac37 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs index 9bd387646078..406cff32fdf5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1f3a3bb8a98e..921b10388991 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index 72e59c9baf44..50db62858883 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 516c952c2071..afdb3342ce23 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 @@ -143,8 +143,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b4307b69a3b6..601c8e998661 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 1540483527a3..db1b090fa3e9 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 96902abd13a6..7c9c96b05c0d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index 101cfb09d2ae..d2f562dc62c7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -177,20 +177,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 674358380306..88c96f83b3a1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2467daa6e2b3..6049305ccc01 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 808a4b66c6f2..2b9dab1b761b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index 8e865d8efae7..d74cab9a645c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs index db407f5e3553..1ced7be525f5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 3b9f00ed6666..47b7b40607a7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 5f369537bb2a..bbc9459f436f 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index f720208fafe0..55e6045dc21e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 50ad5aef5a1b..dc0e8da10833 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs index c9c24d32fc40..0f70b6ee763d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -217,24 +217,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 5a072449fae0..abcca493d7d2 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 6b354389b24a..294770c56dfb 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -201,16 +201,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -218,8 +215,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(PetStatusValueConverter.FromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 6465301de4d0..8a2fc39d76bf 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -747,20 +747,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": string requiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -786,40 +782,31 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": string notrequiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -845,20 +832,16 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": string notrequiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -884,24 +867,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": string requiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); @@ -919,8 +897,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -931,8 +908,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs index 4012eec09fb6..d29f16225c9a 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs index 9d1fbcfd0f6f..fcf8e483d79e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 749507fe8e0c..b9a4a5f9c95c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 08b9d580d9f1..25d27479cb9b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs index d5fb2f5610ad..3ebb619596ee 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 1936341f8ba6..54cbe89d95af 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 46ccc750b1c2..508d19f2807e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs index 0c2e096925ef..62f5b0736d68 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs index a445c5ac182b..012c650e4f1c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs index 87bc3578658c..fd37515f54a2 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -128,8 +128,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 546931023bb4..80ab5ec04b8d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -148,8 +148,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 20b8444349b0..de2cf7f84849 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -248,36 +248,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index cd20dcc6f2a2..c7fa501c3c5d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -162,8 +162,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index e4d0962e9ef4..fdef147cb388 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -134,8 +134,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 9b23c0166650..a09872cef811 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -128,8 +128,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cfe30e6ce660..c338f29efc9d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -128,8 +128,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs index 0899aecaee69..04609b245365 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -162,16 +162,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs index 308d4078b7f3..cf0ee9cdb1aa 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs index 46e11565b533..10375771f80b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -131,12 +131,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index 0a879915fc74..4887c6c7aff7 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -121,8 +121,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()!); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 96854b6b0e4f..936d8dc8b225 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -138,8 +138,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs index a84805aa8011..d908fed19a3a 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -134,8 +134,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs index 837b5ef56bf3..1668434a783f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -179,20 +179,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; 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 83efec82813d..9a6f097e92c2 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 @@ -277,8 +277,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs index 204a7a95d7e3..ea7a5bd26988 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -746,16 +746,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 7b9bfd4fbeb6..971a81e9c8c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -145,12 +145,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 3c5e2512bb04..f4e54444c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -128,8 +128,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index 5244065820ea..5564d0d38435 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -667,71 +667,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()!); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()!); @@ -746,16 +730,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 bba52b3ffbce..06668cf78934 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 @@ -245,20 +245,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs index ac4b562eb3e7..266cbf7f9d2e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -128,8 +128,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs index 7a8da4dbed10..4d5b2c6d94cf 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -128,8 +128,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 17ee15eb2f4d..968a64762901 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -191,20 +191,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index bb28841a9e57..76bffb1856bc 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -148,8 +148,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()!); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index fb877759c605..100ccfa20e5b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -213,19 +213,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index f7e59fb345ac..fdf9064400f4 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -131,12 +131,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs index 91695a8649d6..db7eaa8f675c 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -325,48 +325,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 83619d031144..47db90bf3525 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -129,8 +129,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs index b52b1cc177f1..f7ae912c05e6 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -128,8 +128,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index ec6905ea3a72..fa4f88b3ecdd 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -182,16 +182,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs index a3e3679fe3dc..c4c43309bec1 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -301,24 +301,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index 01d4f3844ebf..4428479e0485 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -162,12 +162,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index 55df1e0579f5..56b981a0e2ad 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -285,16 +285,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()!); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); @@ -302,8 +299,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index 15688d958f05..0c7dc7eab56f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1827,28 +1827,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1864,48 +1858,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1921,28 +1904,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1958,32 +1935,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1991,8 +1961,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2003,8 +1972,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs index 4a1e1fc3b490..6119748b2992 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs @@ -168,8 +168,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()!); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index 0d9fe3516e6f..6276a3a8c8ae 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -171,8 +171,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d520cfcc9a96..245ea1053e5d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -145,12 +145,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index d66e2a9e7328..1fce10cd7823 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -148,8 +148,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index 92de05e2d752..a6c404c940b8 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -145,8 +145,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index ed3d3f74081b..5cbf9d28f57e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -128,8 +128,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 3cd60d602954..e7829b5974ee 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -169,8 +169,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 7b55e2baf5bc..d02f765752fd 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -320,12 +320,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()!); @@ -334,19 +332,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()!); @@ -355,8 +350,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index a655c0d30e99..3d5ad4a7d676 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -158,12 +158,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs index 66a33723aebc..170ad4b54dac 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -128,8 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "count": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs index f9d2680b0ad5..aabac63ce195 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index f5bcaf712030..1da19734a2d3 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 8d4153d53022..5fa49b8033da 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 3b185247e442..78ce72e42861 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 942640761b26..f9d8cb0178a6 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index debcff217b93..6bd3d13aec0c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ded293438a45..c1fc28e5e87e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index ee7b94f08bd3..24f40349480e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 476a1c25352b..e0176c9c103d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index a3a0a15428b4..dd211ecc28ae 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs index f424f8ef9d85..6b4b1efcac37 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs index 9bd387646078..406cff32fdf5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1f3a3bb8a98e..921b10388991 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index 72e59c9baf44..50db62858883 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 4eb9365b1f54..2a7d6a8a5f4d 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 @@ -275,8 +275,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index f7a3a20b1b10..b44f96171f59 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -744,16 +744,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b4307b69a3b6..601c8e998661 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 1540483527a3..db1b090fa3e9 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 96902abd13a6..7c9c96b05c0d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 938d01fec443..796232e12c55 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 @@ -243,20 +243,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 674358380306..88c96f83b3a1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2467daa6e2b3..6049305ccc01 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 808a4b66c6f2..2b9dab1b761b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index 8e865d8efae7..d74cab9a645c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs index db407f5e3553..1ced7be525f5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 3b9f00ed6666..47b7b40607a7 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 5f369537bb2a..bbc9459f436f 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index f720208fafe0..55e6045dc21e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 50ad5aef5a1b..dc0e8da10833 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs index ee5777aabe75..094096b6350d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -299,24 +299,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 5a072449fae0..abcca493d7d2 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 8e7b548b39fd..7e8a3d34957a 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -283,16 +283,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -300,8 +297,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index f1483ce99399..6217ae6e6799 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1825,28 +1825,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1862,48 +1856,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1919,28 +1902,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1956,32 +1933,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1989,8 +1959,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2001,8 +1970,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs index 4012eec09fb6..d29f16225c9a 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs index 9d1fbcfd0f6f..fcf8e483d79e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 749507fe8e0c..b9a4a5f9c95c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 08b9d580d9f1..25d27479cb9b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs index d5fb2f5610ad..3ebb619596ee 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 1936341f8ba6..54cbe89d95af 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 46ccc750b1c2..508d19f2807e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs index 0c2e096925ef..62f5b0736d68 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs index a445c5ac182b..012c650e4f1c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs index 97aaf78dd30a..65645b2e4829 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -129,8 +129,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 993b2a750ce7..728bbb0c349e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -149,8 +149,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index fe4e050f537d..9fa35476f70c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -249,36 +249,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index 4ae5d07dcfef..bf92565f9a2e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -163,8 +163,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 840e615e2280..cbb5ea8f0849 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -135,8 +135,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d27c45fdcd1d..cd3309a5900e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -129,8 +129,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 72dc6b5327f5..90b6e4a8bd14 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -129,8 +129,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs index 947e074e1390..6be410aad46e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -163,16 +163,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs index 06208194730c..1352e54c4091 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -129,8 +129,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs index c145e62672fb..584505890fdc 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -132,12 +132,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 33e8935a249e..00b32d995aa3 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -122,8 +122,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()!); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 286d8b6464b5..0369f8f37e97 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -139,8 +139,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs index dfa0a603bb61..8981331c9e19 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -135,8 +135,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs index 1f8cc5462321..b6400a09e802 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -180,20 +180,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; 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 809acadd5224..5c9774abc417 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 @@ -278,8 +278,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs index 65adf54ea349..897a9bd24efe 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -747,16 +747,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d713d6a161ee..d7c977f2fe4f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -146,12 +146,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index d1d691a8dd2e..9f57f4d6318a 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -129,8 +129,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index d9011f3dbd67..57b32c67f7b3 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -668,71 +668,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()!); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()!); @@ -747,16 +731,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 cf14472204d4..40dee3f15569 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 @@ -246,20 +246,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs index cb6c05a7c77f..cdac03c3bcf4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -129,8 +129,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2f8ac2dc1d53..e9f36662dd80 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -129,8 +129,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index a9e28c2f3e83..3629d644571b 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -192,20 +192,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index a6022a5f9cce..4b3f421263d4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -149,8 +149,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()!); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index 2632fefd0fac..72938274943d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -214,19 +214,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index e3a042f07ea2..212b80559b9f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -132,12 +132,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs index 97697787aa33..aa2baca6ee31 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -326,48 +326,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 7db4f508852b..d0c107c1a216 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -130,8 +130,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs index b33930dee1b7..3662647e6562 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -129,8 +129,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 72d8feb0ba05..b2fced877576 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -183,16 +183,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs index ad8a7fe42d07..fff55dc03b4b 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -302,24 +302,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 9e354ba31085..834a7f3516f1 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -163,12 +163,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index f055e78da6e8..fc68eb27a177 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -286,16 +286,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()!); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); @@ -303,8 +300,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index f8095975d33e..074d0e77ee37 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1828,28 +1828,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1865,48 +1859,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1922,28 +1905,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1959,32 +1936,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1992,8 +1962,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2004,8 +1973,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs index 73b136378454..1c1f18fd1dec 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs @@ -169,8 +169,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()!); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index 14b4548c6105..1544a23710c1 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -172,8 +172,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 8df9de9ae715..28b65b24ecf3 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -146,12 +146,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index c72f3539283b..0cf9332983fd 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -149,8 +149,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index 9ac29533f720..a350814f2c88 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -146,8 +146,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index bfc3a14472d7..37acae1c88df 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -129,8 +129,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index ccb64f191628..df0deacac70e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -170,8 +170,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + data = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index 6692b4f25093..6af3ab9df35c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -321,12 +321,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()!); @@ -335,19 +333,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()!); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()!); @@ -356,8 +351,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()!); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index f3f3e60766df..080a4f804022 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -159,12 +159,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index d07559ec5275..d81a3689e6e1 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -147,12 +147,10 @@ public override NowGet200Response Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "now": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "today": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs index a5e4bd35e9bc..4562d4ceb728 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -126,8 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "activity_outputs": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index d7b4374e6a7b..db832150ed96 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -146,8 +146,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ec17222fbc8f..f70c7a4c5fc3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -246,36 +246,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader switch (localVarJsonPropertyName) { case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "empty_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_2": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_anytype_3": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_with_undeclared_properties_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 77ec0bd5ed2d..74dbae3c6ba3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -160,8 +160,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "code": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "message": message = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1cc72ecd59d3..1a839ecb01b6 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -132,8 +132,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index d2398a452eee..cea3f5a4ba50 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, switch (localVarJsonPropertyName) { case "ArrayArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index cce8d5d564b6..47bac6ba97c6 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -126,8 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "ArrayNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 3fbc72e2f5ab..1992bf9e932d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -160,16 +160,13 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "array_array_of_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_array_of_model": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs index d92ba4ae6aef..d7b7e8188f75 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -126,8 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index c9734cbe3808..8aa8da44caea 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -129,12 +129,10 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "lengthCm": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "sweet": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 780c28a972a6..9ed61c34f667 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -119,8 +119,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, color = new Option(utf8JsonReader.GetString()); break; case "declawed": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs index f483d87f36c8..7db5ba3129ff 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -136,8 +136,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 1c478cf336df..62ae935e4564 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -132,8 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "dateOnlyProperty": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index a853b96144e2..e83b95303760 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -177,20 +177,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "mainShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; 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 b6716a58e539..c107741e961d 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 @@ -275,8 +275,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "array_enum": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 08e961298725..40d5e2753631 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -744,16 +744,13 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); break; case "enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerEnum?)null : (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumIntegerOnlyEnum?)null : (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (EnumTest.EnumNumberEnum?)null : (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f9d9d9f7a7b8..76db6338890f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -143,12 +143,10 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "file": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c7d043666115..285e193a7e15 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -126,8 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty switch (localVarJsonPropertyName) { case "string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 86d63c7ac5f6..a4410d55b34a 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -665,71 +665,55 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "byte": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); + number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "password": password = new Option(utf8JsonReader.GetString()); break; case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (double?)null : utf8JsonReader.GetDouble()); break; case "float": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (float?)null : (float)utf8JsonReader.GetDouble()); break; case "int32": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int32Range": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32Range = new Option(utf8JsonReader.GetInt32()); + int32Range = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "int64Negative": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Negative = new Option(utf8JsonReader.GetInt32()); + int64Negative = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64NegativeExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + int64NegativeExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64Positive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64Positive = new Option(utf8JsonReader.GetInt32()); + int64Positive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "int64PositiveExclusive": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + int64PositiveExclusive = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": patternWithBackslash = new Option(utf8JsonReader.GetString()); @@ -744,16 +728,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (uint?)null : utf8JsonReader.GetUInt32()); break; case "unsigned_long": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (ulong?)null : utf8JsonReader.GetUInt64()); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; 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 97588d56888a..0af46ec34e41 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 @@ -243,20 +243,16 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "direct_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_map_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_of_enum_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index c81de3d2f67d..3a559f831196 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -126,8 +126,7 @@ public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index 32515bc04405..5e238e0f7b30 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -126,8 +126,7 @@ public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "content": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cef3330300e..e0462d7c8a25 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -189,20 +189,16 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea switch (localVarJsonPropertyName) { case "dateTime": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index bf37307ad965..882bf7ccda47 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -146,8 +146,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty varClass = new Option(utf8JsonReader.GetString()); break; case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs index b322aaf568ce..dba5779e547d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -211,19 +211,16 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "name": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "property": property = new Option(utf8JsonReader.GetString()); break; case "snake_case": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "123Number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ea8abdda0d78..9da492190051 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -129,12 +129,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "a_objVariableobject": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 42533f9c7ebf..397f12bffbb0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -323,48 +323,37 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "array_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "number_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": stringProp = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 286d13258dce..6efbeef44dcd 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -127,8 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 29f5a80e6462..55ab016ac3db 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -126,8 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "JustNumber": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 83f513bc63bb..541a621953aa 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -180,16 +180,13 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade switch (localVarJsonPropertyName) { case "bars": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs index 580ef432ecf1..ad31eb6ad143 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -299,24 +299,19 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "petId": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "quantity": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "shipDate": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 92ec1939d1af..d366c24ec24c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -160,12 +160,10 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "my_boolean": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "my_number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (decimal?)null : utf8JsonReader.GetDecimal()); break; case "my_string": myString = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 81d80e33de70..e8e661445a1c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -283,16 +283,13 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, name = new Option(utf8JsonReader.GetString()); break; case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); @@ -300,8 +297,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 0990c0ab7a40..fee9ba7f2965 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1825,28 +1825,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_notnullable_enum_string": string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1862,48 +1856,37 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "not_required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + notRequiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_notnullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNotnullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_notnullable_enum_string": string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1919,28 +1902,22 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNotnullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + notrequiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "notrequired_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + notrequiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "notrequired_nullable_enum_string": string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1956,32 +1933,25 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + notrequiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + requiredNullableBooleanProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumInteger = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerEnum?)null : (RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + requiredNullableEnumIntegerOnly = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (RequiredClass.RequiredNullableEnumIntegerOnlyEnum?)null : (RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "required_nullable_enum_string": string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); @@ -1989,8 +1959,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); break; case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + requiredNullableIntegerProp = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "required_nullable_outerEnumDefaultValue": string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); @@ -2001,8 +1970,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT requiredNullableStringProp = new Option(utf8JsonReader.GetString()); break; case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + requiredNullableUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs index 4b0b889b708e..fb1b3546a031 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -166,8 +166,7 @@ public override Result Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver code = new Option(utf8JsonReader.GetString()); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs index 6a2c4c85eb4a..81211e0ce4ac 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -169,8 +169,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver varAbstract = new Option(utf8JsonReader.GetString()); break; case "return": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "unsafe": varUnsafe = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 46625cb093a3..5b7a88bd659a 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -143,12 +143,10 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "role": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (Guid?)null : utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7ec3c110c2a1..f30e2a11997b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -146,8 +146,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 4290e8270ff9..6b9d5082405b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -143,8 +143,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "name": name = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 04d04337aa4a..7328caf1ead5 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -126,8 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u switch (localVarJsonPropertyName) { case "TestCollectionEndingWithWordList": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 4d237900519a..cfa1aee10f8d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -167,8 +167,7 @@ public override TestResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo code = new Option(TestResultCodeValueConverter.FromStringOrDefault(codeRawValue)); break; case "data": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + data = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": uuid = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs index e89d58457324..a85e556bb9e8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -318,12 +318,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "email": email = new Option(utf8JsonReader.GetString()); @@ -332,19 +330,16 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, firstName = new Option(utf8JsonReader.GetString()); break; case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (long?)null : utf8JsonReader.GetInt64()); break; case "lastName": lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": password = new Option(utf8JsonReader.GetString()); @@ -353,8 +348,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); break; case "username": username = new Option(utf8JsonReader.GetString()); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 834e6957c675..56da6f6db3c6 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -156,12 +156,10 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; case "hasTeeth": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (bool?)null : utf8JsonReader.GetBoolean()); break; default: break;